From 0c718afe9014f89c49eb1c762d42735f00b03a33 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sat, 25 Jul 2015 16:53:35 +0200 Subject: core: check genesis block before writeout --- core/genesis.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/genesis.go b/core/genesis.go index 7d3727b82..a88e88ea8 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -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) -- cgit