Commit f6097f4a authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

Merge pull request #1522 from obscuren/genesis-block-check

core: check genesis block before writeout
parents d4428cc7 0c718afe
...@@ -82,6 +82,10 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ ...@@ -82,6 +82,10 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ
}, nil, nil, nil) }, nil, nil, nil)
block.Td = difficulty block.Td = difficulty
if block := GetBlockByHash(blockDb, block.Hash()); block != nil {
return nil, fmt.Errorf("Block %x already in database", block.Hash())
}
statedb.Sync() statedb.Sync()
err = WriteBlock(blockDb, block) err = WriteBlock(blockDb, block)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment