diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-04-21 17:14:57 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-04-21 17:14:57 +0800 |
commit | b06f44ecc2b8f0c0506dd4239ee3d70eac4d1005 (patch) | |
tree | 427e186ce661bf4b8f0151d6080436c26eb22050 /cmd/utils/flags.go | |
parent | 18580e152c1a2480b6245ebba4c62c202ed20ac6 (diff) | |
download | go-tangerine-b06f44ecc2b8f0c0506dd4239ee3d70eac4d1005.tar.gz go-tangerine-b06f44ecc2b8f0c0506dd4239ee3d70eac4d1005.tar.zst go-tangerine-b06f44ecc2b8f0c0506dd4239ee3d70eac4d1005.zip |
cmd: add a `--fakepow` flag to help benchmarking database changes
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r-- | cmd/utils/flags.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 52060c795..8d55ac8b9 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -47,6 +47,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/pow" "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/whisper" ) @@ -228,6 +229,10 @@ var ( Name: metrics.MetricsEnabledFlag, Usage: "Enable metrics collection and reporting", } + FakePoWFlag = cli.BoolFlag{ + Name: "fakepow", + Usage: "Disables proof-of-work verification", + } // RPC settings RPCEnabledFlag = cli.BoolFlag{ @@ -842,11 +847,13 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database glog.Fatalln(err) } } - chainConfig := MustMakeChainConfigFromDb(ctx, chainDb) - var eventMux event.TypeMux - chain, err = core.NewBlockChain(chainDb, chainConfig, ethash.New(), &eventMux) + pow := pow.PoW(core.FakePow{}) + if !ctx.GlobalBool(FakePoWFlag.Name) { + pow = ethash.New() + } + chain, err = core.NewBlockChain(chainDb, chainConfig, pow, new(event.TypeMux)) if err != nil { Fatalf("Could not start chainmanager: %v", err) } |