aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-04 16:42:41 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-01-04 16:42:41 +0800
commit2ce30382d9bbda91e3b253029082e6add2d51294 (patch)
treec79e8154f5ece9b6b89dd82a2c6bd35164689cb8 /eth
parent891fcd8ce133dd118a4ae96b3bb36e700ae7cc0f (diff)
downloadgo-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.tar
go-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.tar.gz
go-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.tar.bz2
go-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.tar.lz
go-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.tar.xz
go-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.tar.zst
go-tangerine-2ce30382d9bbda91e3b253029082e6add2d51294.zip
cmd/utils, eth, les: bubble --fakepow flag into eth/les too
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/eth/backend.go b/eth/backend.go
index f98c9b724..dec8c0c6e 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/params"
+ "github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rpc"
)
@@ -79,6 +80,7 @@ type Config struct {
NatSpec bool
DocRoot string
AutoDAG bool
+ PowFake bool
PowTest bool
PowShared bool
ExtraData []byte
@@ -125,7 +127,7 @@ type Ethereum struct {
chainDb ethdb.Database // Block chain database
eventMux *event.TypeMux
- pow *ethash.Ethash
+ pow pow.PoW
accountManager *accounts.Manager
ApiBackend *EthApiBackend
@@ -139,7 +141,6 @@ type Ethereum struct {
solcPath string
NatSpec bool
- PowTest bool
netVersionId int
netRPCService *ethapi.PublicNetAPI
}
@@ -174,7 +175,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
stopDbUpgrade: stopDbUpgrade,
netVersionId: config.NetworkId,
NatSpec: config.NatSpec,
- PowTest: config.PowTest,
etherbase: config.Etherbase,
MinerThreads: config.MinerThreads,
AutoDAG: config.AutoDAG,
@@ -293,15 +293,17 @@ func SetupGenesisBlock(chainDb *ethdb.Database, config *Config) error {
}
// CreatePoW creates the required type of PoW instance for an Ethereum service
-func CreatePoW(config *Config) (*ethash.Ethash, error) {
+func CreatePoW(config *Config) (pow.PoW, error) {
switch {
+ case config.PowFake:
+ glog.V(logger.Info).Infof("ethash used in fake mode")
+ return pow.PoW(core.FakePow{}), nil
case config.PowTest:
glog.V(logger.Info).Infof("ethash used in test mode")
return ethash.NewForTesting()
case config.PowShared:
glog.V(logger.Info).Infof("ethash used in shared mode")
return ethash.NewShared(), nil
-
default:
return ethash.New(), nil
}
@@ -399,7 +401,7 @@ func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager
func (s *Ethereum) BlockChain() *core.BlockChain { return s.blockchain }
func (s *Ethereum) TxPool() *core.TxPool { return s.txPool }
func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux }
-func (s *Ethereum) Pow() *ethash.Ethash { return s.pow }
+func (s *Ethereum) Pow() pow.PoW { return s.pow }
func (s *Ethereum) ChainDb() ethdb.Database { return s.chainDb }
func (s *Ethereum) IsListening() bool { return true } // Always listening
func (s *Ethereum) EthVersion() int { return int(s.protocolManager.SubProtocols[0].Version) }