diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-10-11 18:10:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 18:10:18 +0800 |
commit | ad444752311b1a318a7933562749b4586d4469e9 (patch) | |
tree | ac0df3e6fc330a186d409adb723a78e16b5605ea /cmd/utils/flags.go | |
parent | cefeb5859866f2fe119b7936f7c97137b7efb7b6 (diff) | |
parent | 35767dfd0c468872acf99c3fccc3a206ce709128 (diff) | |
download | dexon-ad444752311b1a318a7933562749b4586d4469e9.tar.gz dexon-ad444752311b1a318a7933562749b4586d4469e9.tar.zst dexon-ad444752311b1a318a7933562749b4586d4469e9.zip |
Merge pull request #14785 from Arachnid/downloaddb
cmd: Added support for downloading to another DB instance
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r-- | cmd/utils/flags.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index a62b4940b..bfef619f6 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -31,6 +31,8 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/consensus/clique" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" @@ -1086,17 +1088,22 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai var err error chainDb = MakeChainDatabase(ctx, stack) - engine := ethash.NewFaker() - if !ctx.GlobalBool(FakePoWFlag.Name) { - engine = ethash.New( - stack.ResolvePath(eth.DefaultConfig.EthashCacheDir), eth.DefaultConfig.EthashCachesInMem, eth.DefaultConfig.EthashCachesOnDisk, - stack.ResolvePath(eth.DefaultConfig.EthashDatasetDir), eth.DefaultConfig.EthashDatasetsInMem, eth.DefaultConfig.EthashDatasetsOnDisk, - ) - } config, _, err := core.SetupGenesisBlock(chainDb, MakeGenesis(ctx)) if err != nil { Fatalf("%v", err) } + var engine consensus.Engine + if config.Clique != nil { + engine = clique.New(config.Clique, chainDb) + } else { + engine = ethash.NewFaker() + if !ctx.GlobalBool(FakePoWFlag.Name) { + engine = ethash.New( + stack.ResolvePath(eth.DefaultConfig.EthashCacheDir), eth.DefaultConfig.EthashCachesInMem, eth.DefaultConfig.EthashCachesOnDisk, + stack.ResolvePath(eth.DefaultConfig.EthashDatasetDir), eth.DefaultConfig.EthashDatasetsInMem, eth.DefaultConfig.EthashDatasetsOnDisk, + ) + } + } vmcfg := vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)} chain, err = core.NewBlockChain(chainDb, config, engine, vmcfg) if err != nil { |