diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-25 22:53:35 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-25 22:53:35 +0800 |
commit | 0c718afe9014f89c49eb1c762d42735f00b03a33 (patch) | |
tree | b4275382f1bd8a22498d587716a6f3440a2ff9c2 /core/genesis.go | |
parent | 5001f778aac5cf77a200da7829f8d28547208fed (diff) | |
download | dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.gz dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.zst dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.zip |
core: check genesis block before writeout
Diffstat (limited to 'core/genesis.go')
-rw-r--r-- | core/genesis.go | 4 |
1 files changed, 4 insertions, 0 deletions
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) |