From c273ed7d82f3d5beab7c213fbe1f5c0942adf0bd Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Wed, 22 Apr 2015 12:46:41 +0200 Subject: Moved leveldb update loop to eth/backend change order of block insert and update LastBlock bugfix, wrong hash stored in blockDb --- core/chain_manager.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/chain_manager.go') diff --git a/core/chain_manager.go b/core/chain_manager.go index 47f84b80a..a09b2e63b 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -342,14 +342,14 @@ func (self *ChainManager) Export(w io.Writer) error { } func (bc *ChainManager) insert(block *types.Block) { - bc.blockDb.Put([]byte("LastBlock"), block.Hash().Bytes()) - bc.currentBlock = block - bc.lastBlockHash = block.Hash() - key := append(blockNumPre, block.Number().Bytes()...) - bc.blockDb.Put(key, bc.lastBlockHash.Bytes()) + bc.blockDb.Put(key, block.Hash().Bytes()) // Push block to cache bc.cache.Push(block) + + bc.blockDb.Put([]byte("LastBlock"), block.Hash().Bytes()) + bc.currentBlock = block + bc.lastBlockHash = block.Hash() } func (bc *ChainManager) write(block *types.Block) { -- cgit