aboutsummaryrefslogtreecommitdiffstats
path: root/core/genesis.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-25 22:53:35 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-25 22:53:35 +0800
commit0c718afe9014f89c49eb1c762d42735f00b03a33 (patch)
treeb4275382f1bd8a22498d587716a6f3440a2ff9c2 /core/genesis.go
parent5001f778aac5cf77a200da7829f8d28547208fed (diff)
downloaddexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar
dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.gz
dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.bz2
dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.lz
dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.xz
dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.tar.zst
dexon-0c718afe9014f89c49eb1c762d42735f00b03a33.zip
core: check genesis block before writeout
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go4
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)