aboutsummaryrefslogtreecommitdiffstats
path: root/core/genesis.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-26 03:48:53 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-26 03:52:37 +0800
commitb0df9b164c4b4b0c5cc8ada220c4908b01acafcd (patch)
tree983560ba2dd866a7838597884ea358e28bf4d9c7 /core/genesis.go
parent72188234aa0155a0cf8acce87cb7e5bdb8dfa128 (diff)
downloadgo-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.tar
go-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.tar.gz
go-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.tar.bz2
go-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.tar.lz
go-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.tar.xz
go-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.tar.zst
go-tangerine-b0df9b164c4b4b0c5cc8ada220c4908b01acafcd.zip
core: fixed genesis write out to write only canon number
Diffstat (limited to 'core/genesis.go')
-rw-r--r--core/genesis.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/genesis.go b/core/genesis.go
index a88e88ea8..2f218724a 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -27,6 +27,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params"
)
@@ -83,7 +85,12 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ
block.Td = difficulty
if block := GetBlockByHash(blockDb, block.Hash()); block != nil {
- return nil, fmt.Errorf("Block %x already in database", block.Hash())
+ glog.V(logger.Info).Infoln("Genesis block already in chain. Writing canonical number")
+ err := WriteCanonNumber(blockDb, block)
+ if err != nil {
+ return nil, err
+ }
+ return block, nil
}
statedb.Sync()