From 6244b10a8f74d92addf977994e5a9c0e457229bb Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 8 Jun 2015 12:12:13 +0200 Subject: 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. --- eth/backend.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'eth') 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()) -- cgit