mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-27 16:17:22 +00:00
Merge pull request #1522 from obscuren/genesis-block-check
core: check genesis block before writeout
This commit is contained in:
commit
f6097f4a0a
1 changed files with 4 additions and 0 deletions
|
|
@ -82,6 +82,10 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ
|
|||
}, nil, nil, nil)
|
||||
block.Td = difficulty
|
||||
|
||||
if block := GetBlockByHash(blockDb, block.Hash()); block != nil {
|
||||
return nil, fmt.Errorf("Block %x already in database", block.Hash())
|
||||
}
|
||||
|
||||
statedb.Sync()
|
||||
|
||||
err = WriteBlock(blockDb, block)
|
||||
|
|
|
|||
Loading…
Reference in a new issue