aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-07-25 23:10:08 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-07-25 23:10:08 +0800
commitf6097f4a0abd6d48f55b2f16048fcbb73e170fca (patch)
treef18ec053085acb9c7c0e0dee84b40e55ea49a71a
parentd4428cc77ff7096a099fc15b85785f47c9d18387 (diff)
parent0c718afe9014f89c49eb1c762d42735f00b03a33 (diff)
downloaddexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.tar
dexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.tar.gz
dexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.tar.bz2
dexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.tar.lz
dexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.tar.xz
dexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.tar.zst
dexon-f6097f4a0abd6d48f55b2f16048fcbb73e170fca.zip
Merge pull request #1522 from obscuren/genesis-block-check
core: check genesis block before writeout
-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)