diff options
author | Bas van Kervel <basvankervel@gmail.com> | 2015-04-22 18:50:33 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@gmail.com> | 2015-04-22 18:50:33 +0800 |
commit | c9e22976f59f788a9776beab346e7dcf25af48ac (patch) | |
tree | 5612cda8d266c17b5a9acc282cc2aa00d7d4bc3d | |
parent | 07e85d8e146c0aa08fcfe0871d1e9b69487e67ea (diff) | |
download | dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.tar dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.tar.gz dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.tar.bz2 dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.tar.lz dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.tar.xz dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.tar.zst dexon-c9e22976f59f788a9776beab346e7dcf25af48ac.zip |
change order of block insert and update LastBlock
-rw-r--r-- | core/chain_manager.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go index 1df56b27f..e5fcd4afc 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()) // 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) { |