Commit c9e22976 authored by Bas van Kervel's avatar Bas van Kervel

change order of block insert and update LastBlock

parent 07e85d8e
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment