diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2016-04-05 21:22:04 +0800 |
---|---|---|
committer | zsfelfoldi <zsfelfoldi@gmail.com> | 2016-06-07 22:38:56 +0800 |
commit | f9917c8c7b6d16daadebd72977e56a8adc0382b0 (patch) | |
tree | eb11524c618a44dbd499918761ba176a9addba58 /core/genesis.go | |
parent | 5a458da42ae9a6525989c2d4515c6fa573ba8f8c (diff) | |
download | dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.tar dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.tar.gz dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.tar.bz2 dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.tar.lz dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.tar.xz dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.tar.zst dexon-f9917c8c7b6d16daadebd72977e56a8adc0382b0.zip |
core: improved chainDb using sequential keys
Diffstat (limited to 'core/genesis.go')
-rw-r--r-- | core/genesis.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/genesis.go b/core/genesis.go index 40d799621..637b63320 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -88,7 +88,7 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, Root: root, }, nil, nil, nil) - if block := GetBlock(chainDb, block.Hash()); block != nil { + if block := GetBlock(chainDb, block.Hash(), block.NumberU64()); block != nil { glog.V(logger.Info).Infoln("Genesis block already in chain. Writing canonical number") err := WriteCanonicalHash(chainDb, block.Hash(), block.NumberU64()) if err != nil { @@ -100,13 +100,13 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, if err := stateBatch.Write(); err != nil { return nil, fmt.Errorf("cannot write state: %v", err) } - if err := WriteTd(chainDb, block.Hash(), difficulty); err != nil { + if err := WriteTd(chainDb, block.Hash(), block.NumberU64(), difficulty); err != nil { return nil, err } if err := WriteBlock(chainDb, block); err != nil { return nil, err } - if err := WriteBlockReceipts(chainDb, block.Hash(), nil); err != nil { + if err := WriteBlockReceipts(chainDb, block.Hash(), block.NumberU64(), nil); err != nil { return nil, err } if err := WriteCanonicalHash(chainDb, block.Hash(), block.NumberU64()); err != nil { |