makeup tomoclean, add make tomoclean

This commit is contained in:
Tuna 2019-04-23 13:42:19 +07:00
parent 675bf80ad3
commit 6744850661
2 changed files with 21 additions and 16 deletions

View file

@ -15,6 +15,11 @@ tomo:
@echo "Done building." @echo "Done building."
@echo "Run \"$(GOBIN)/tomo\" to launch tomo." @echo "Run \"$(GOBIN)/tomo\" to launch tomo."
tomoclean:
build/env.sh go run build/ci.go install ./cmd/tomoclean
@echo "Done building."
@echo "Run \"$(GOBIN)/tomoclean\" to launch tomoclean."
bootnode: bootnode:
build/env.sh go run build/ci.go install ./cmd/bootnode build/env.sh go run build/ci.go install ./cmd/bootnode
@echo "Done building." @echo "Done building."

View file

@ -3,6 +3,13 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"os"
"os/signal"
"runtime"
"sync"
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
@ -14,17 +21,18 @@ import (
"github.com/hashicorp/golang-lru" "github.com/hashicorp/golang-lru"
"github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/util" "github.com/syndtr/goleveldb/leveldb/util"
"os"
"os/signal"
"runtime"
"sync"
"sync/atomic"
"time"
) )
var ( var (
dir = flag.String("dir", "", "dir to mainet chain data") dir = flag.String("dir", "", "directory to TomoChain chaindata")
cacheSize = flag.Int("size", 1000000, "dir to mainet chain data") cacheSize = flag.Int("size", 1000000, "LRU cache size")
sercureKey = []byte("secure-key-")
nWorker = runtime.NumCPU() / 2
cleanAddress = []common.Address{common.HexToAddress(common.BlockSigners)}
cache *lru.Cache
finish = int32(0)
running = true
stateRoots = make(chan TrieRoot)
) )
type TrieRoot struct { type TrieRoot struct {
@ -42,14 +50,6 @@ type ResultProcessNode struct {
keys [17]*[]byte keys [17]*[]byte
} }
var sercureKey = []byte("secure-key-")
var nWorker = runtime.NumCPU() / 2
var cleanAddress = []common.Address{common.HexToAddress(common.BlockSigners)}
var cache *lru.Cache
var finish = int32(0)
var running = true
var stateRoots = make(chan TrieRoot)
func main() { func main() {
flag.Parse() flag.Parse()
lddb, _ := ethdb.NewLDBDatabase(*dir, eth.DefaultConfig.DatabaseCache, utils.MakeDatabaseHandles()) lddb, _ := ethdb.NewLDBDatabase(*dir, eth.DefaultConfig.DatabaseCache, utils.MakeDatabaseHandles())