diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-04-29 19:19:38 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-04-29 19:19:38 +0800 |
commit | 9672a62a382380347ff6d5ecc5a205a9836b5ae1 (patch) | |
tree | 78611bdb9799b3f3f0e0357d031d714e2eb98391 | |
parent | 0f722df2d9578c7deb15c8dba5ec70add98c34de (diff) | |
parent | b06f44ecc2b8f0c0506dd4239ee3d70eac4d1005 (diff) | |
download | dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.tar dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.tar.gz dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.tar.bz2 dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.tar.lz dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.tar.xz dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.tar.zst dexon-9672a62a382380347ff6d5ecc5a205a9836b5ae1.zip |
Merge pull request #2485 from karalabe/fakepow
cmd: add a `--fakepow` flag to help benchmarking database changes
-rw-r--r-- | cmd/geth/main.go | 1 | ||||
-rw-r--r-- | cmd/geth/usage.go | 7 | ||||
-rw-r--r-- | cmd/utils/flags.go | 13 |
3 files changed, 16 insertions, 5 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index a43daba2f..ffeb7c1e5 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -206,6 +206,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.NetworkIdFlag, utils.RPCCORSDomainFlag, utils.MetricsEnabledFlag, + utils.FakePoWFlag, utils.SolcPathFlag, utils.GpoMinGasPriceFlag, utils.GpoMaxGasPriceFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 278a55980..90019d7b9 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -150,8 +150,11 @@ var AppHelpFlagGroups = []flagGroup{ }, }, { - Name: "LOGGING AND DEBUGGING", - Flags: append([]cli.Flag{utils.MetricsEnabledFlag}, debug.Flags...), + Name: "LOGGING AND DEBUGGING", + Flags: append([]cli.Flag{ + utils.MetricsEnabledFlag, + utils.FakePoWFlag, + }, debug.Flags...), }, { Name: "EXPERIMENTAL", 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) } |