aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_manager.go
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@gmail.com>2015-04-22 18:46:41 +0800
committerBas van Kervel <basvankervel@gmail.com>2015-04-23 23:58:58 +0800
commitc273ed7d82f3d5beab7c213fbe1f5c0942adf0bd (patch)
tree623972174faa894c499a7ad808668cb64e17cbcd /core/chain_manager.go
parent94f2adb80a54c9bddacf146138d8e218a95629c9 (diff)
downloaddexon-c273ed7d82f3d5beab7c213fbe1f5c0942adf0bd.tar.gz
dexon-c273ed7d82f3d5beab7c213fbe1f5c0942adf0bd.tar.zst
dexon-c273ed7d82f3d5beab7c213fbe1f5c0942adf0bd.zip
Moved leveldb update loop to eth/backend
change order of block insert and update LastBlock bugfix, wrong hash stored in blockDb
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r--core/chain_manager.go10
1 files changed, 5 insertions, 5 deletions
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) {