Commit ca8cb65b authored by Péter Szilágyi's avatar Péter Szilágyi

core: fix data race accessing ChainManager.currentBlock

parent 07baf662
......@@ -379,8 +379,11 @@ func (self *ChainManager) ExportN(w io.Writer, first uint64, last uint64) error
func (bc *ChainManager) insert(block *types.Block) {
key := append(blockNumPre, block.Number().Bytes()...)
bc.blockDb.Put(key, block.Hash().Bytes())
bc.blockDb.Put([]byte("LastBlock"), block.Hash().Bytes())
bc.mu.Lock()
defer bc.mu.Unlock()
bc.currentBlock = block
bc.lastBlockHash = block.Hash()
}
......
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