core: check genesis block before writeout

This commit is contained in:
Jeffrey Wilcke 2015-07-25 16:53:35 +02:00
parent 0262ba58cb
commit eaed7584f1
1 changed files with 4 additions and 0 deletions

View File

@ -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)