From 2e19f7905d486e6631ba0527cb3de03ff3790a0d Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Sun, 18 Mar 2018 22:48:07 -0400 Subject: [PATCH 1/3] Disable ethash by replacing with ethash.NewFullFake --- eth/backend.go | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 7fb48c9d0..c8b302bf4 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -235,22 +235,11 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig } // Otherwise assume proof-of-work - switch { - case config.PowFake: - log.Warn("Ethash used in fake mode") - return ethash.NewFaker() - case config.PowTest: - log.Warn("Ethash used in test mode") - return ethash.NewTester() - case config.PowShared: - log.Warn("Ethash used in shared mode") - return ethash.NewShared() - default: - engine := ethash.New(ctx.ResolvePath(config.EthashCacheDir), config.EthashCachesInMem, config.EthashCachesOnDisk, - config.EthashDatasetDir, config.EthashDatasetsInMem, config.EthashDatasetsOnDisk) - engine.SetThreads(-1) // Disable CPU mining - return engine - } + // For Quorum, Raft run as a separate service, so + // the Ethereum service still needs a consensus engine, + // use the consensus with the lightest overhead + log.Warn("Ethash used in full fake mode") + return ethash.NewFullFaker() } // APIs returns the collection of RPC services the ethereum package offers. From c535103027e37128557a1f8b90f9b4be049a5a55 Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Wed, 18 Apr 2018 17:49:31 -0400 Subject: [PATCH 2/3] Addressing Sam's comment in the PR: make the FullFake engine the default so other test/fake flavors can still be used --- eth/backend.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index c8b302bf4..7bff84663 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -235,11 +235,23 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig } // Otherwise assume proof-of-work - // For Quorum, Raft run as a separate service, so - // the Ethereum service still needs a consensus engine, - // use the consensus with the lightest overhead - log.Warn("Ethash used in full fake mode") - return ethash.NewFullFaker() + switch { + case config.PowFake: + log.Warn("Ethash used in fake mode") + return ethash.NewFaker() + case config.PowTest: + log.Warn("Ethash used in test mode") + return ethash.NewTester() + case config.PowShared: + log.Warn("Ethash used in shared mode") + return ethash.NewShared() + default: + // For Quorum, Raft run as a separate service, so + // the Ethereum service still needs a consensus engine, + // use the consensus with the lightest overhead + log.Warn("Ethash used in full fake mode") + return ethash.NewFullFaker() + } } // APIs returns the collection of RPC services the ethereum package offers. From 51274bd368bc93694babe69ee60a5f94758f31ae Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Thu, 19 Apr 2018 15:02:05 -0400 Subject: [PATCH 3/3] reformatted with 'gofmt' --- eth/backend.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 7bff84663..3e970b28b 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -235,23 +235,23 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig } // Otherwise assume proof-of-work - switch { - case config.PowFake: - log.Warn("Ethash used in fake mode") - return ethash.NewFaker() - case config.PowTest: - log.Warn("Ethash used in test mode") - return ethash.NewTester() - case config.PowShared: - log.Warn("Ethash used in shared mode") - return ethash.NewShared() - default: - // For Quorum, Raft run as a separate service, so - // the Ethereum service still needs a consensus engine, - // use the consensus with the lightest overhead - log.Warn("Ethash used in full fake mode") - return ethash.NewFullFaker() - } + switch { + case config.PowFake: + log.Warn("Ethash used in fake mode") + return ethash.NewFaker() + case config.PowTest: + log.Warn("Ethash used in test mode") + return ethash.NewTester() + case config.PowShared: + log.Warn("Ethash used in shared mode") + return ethash.NewShared() + default: + // For Quorum, Raft run as a separate service, so + // the Ethereum service still needs a consensus engine, + // use the consensus with the lightest overhead + log.Warn("Ethash used in full fake mode") + return ethash.NewFullFaker() + } } // APIs returns the collection of RPC services the ethereum package offers.