core: check genesis block before writeout

pull/1509/head
Jeffrey Wilcke 9 years ago
parent 0262ba58cb
commit eaed7584f1
  1. 4
      core/genesis.go

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

Loading…
Cancel
Save