aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-10-10 20:51:09 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-10-10 20:52:11 +0800
commit35767dfd0c468872acf99c3fccc3a206ce709128 (patch)
tree6faa032e12a83fd0727160fe6b51e15b8521bdcf /cmd/utils
parent345332906c213203b90b0d59c9a1127e46d8ca85 (diff)
downloadgo-tangerine-35767dfd0c468872acf99c3fccc3a206ce709128.tar.gz
go-tangerine-35767dfd0c468872acf99c3fccc3a206ce709128.tar.zst
go-tangerine-35767dfd0c468872acf99c3fccc3a206ce709128.zip
cmd, eth: separate out FakePeer for future reuse
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go21
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 {