diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-08 18:12:13 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-09 00:33:43 +0800 |
commit | 6244b10a8f74d92addf977994e5a9c0e457229bb (patch) | |
tree | 30ad7e939d001e8a1400b76e4403546777c9f3aa /eth | |
parent | c6faa18ec9630066683548ed410e364555fd838d (diff) | |
download | dexon-6244b10a8f74d92addf977994e5a9c0e457229bb.tar.gz dexon-6244b10a8f74d92addf977994e5a9c0e457229bb.tar.zst dexon-6244b10a8f74d92addf977994e5a9c0e457229bb.zip |
core: settable genesis nonce
You can set the nonce of the block with `--genesisnonce`. When the
genesis nonce changes and it doesn't match with the first block in your
database it will fail. A new `datadir` must be given if the nonce of the
genesis block changes.
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/eth/backend.go b/eth/backend.go index 3956dfcaa..06627416d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -58,6 +58,7 @@ type Config struct { Name string ProtocolVersion int NetworkId int + GenesisNonce int BlockChainVersion int SkipBcVersionCheck bool // e.g. blockchain export @@ -284,7 +285,11 @@ func New(config *Config) (*Ethereum, error) { } eth.pow = ethash.New() - eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.pow, eth.EventMux()) + genesis := core.GenesisBlock(uint64(config.GenesisNonce), blockDb) + eth.chainManager, err = core.NewChainManager(genesis, blockDb, stateDb, eth.pow, eth.EventMux()) + if err != nil { + return nil, err + } eth.downloader = downloader.New(eth.EventMux(), eth.chainManager.HasBlock, eth.chainManager.GetBlock) eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State, eth.chainManager.GasLimit) eth.blockProcessor = core.NewBlockProcessor(stateDb, extraDb, eth.pow, eth.chainManager, eth.EventMux()) |