aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-06 17:37:32 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-03-09 22:50:14 +0800
commit023670f6bafcfed28c01857da215217a5dadfaa1 (patch)
tree2ced9d0178bfd8d101356a64522cf0225f98362e /eth
parent567d41d9363706b4b13ce0903804e8acf214af49 (diff)
downloaddexon-023670f6bafcfed28c01857da215217a5dadfaa1.tar.gz
dexon-023670f6bafcfed28c01857da215217a5dadfaa1.tar.zst
dexon-023670f6bafcfed28c01857da215217a5dadfaa1.zip
cmd, eth, les, node, pow: disk caching and progress reports
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 024520b13..d49251d75 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -84,6 +84,12 @@ type Config struct {
PowShared bool
ExtraData []byte
+ EthashCacheDir string
+ EthashCachesInMem int
+ EthashCachesOnDisk int
+ EthashDatasetDir string
+ EthashDatasetsOnDisk int
+
Etherbase common.Address
GasPrice *big.Int
MinerThreads int
@@ -157,16 +163,11 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
if err := SetupGenesisBlock(&chainDb, config); err != nil {
return nil, err
}
- pow, err := CreatePoW(config)
- if err != nil {
- return nil, err
- }
-
eth := &Ethereum{
chainDb: chainDb,
eventMux: ctx.EventMux,
accountManager: ctx.AccountManager,
- pow: pow,
+ pow: CreatePoW(ctx, config),
shutdownChan: make(chan bool),
stopDbUpgrade: stopDbUpgrade,
netVersionId: config.NetworkId,
@@ -284,19 +285,20 @@ func SetupGenesisBlock(chainDb *ethdb.Database, config *Config) error {
}
// CreatePoW creates the required type of PoW instance for an Ethereum service
-func CreatePoW(config *Config) (pow.PoW, error) {
+func CreatePoW(ctx *node.ServiceContext, config *Config) pow.PoW {
switch {
case config.PowFake:
log.Warn("Ethash used in fake mode")
- return pow.FakePow{}, nil
+ return pow.FakePow{}
case config.PowTest:
log.Warn("Ethash used in test mode")
- return pow.NewTestEthash(), nil
+ return pow.NewTestEthash()
case config.PowShared:
log.Warn("Ethash used in shared mode")
- return pow.NewSharedEthash(), nil
+ return pow.NewSharedEthash()
default:
- return pow.NewFullEthash("", ""), nil
+ return pow.NewFullEthash(ctx.ResolvePath(config.EthashCacheDir), config.EthashCachesInMem, config.EthashCachesOnDisk,
+ config.EthashDatasetDir, config.EthashDatasetsOnDisk)
}
}