mirror of https://github.com/status-im/op-geth.git
change order of block insert and update LastBlock
This commit is contained in:
parent
07e85d8e14
commit
c9e22976f5
|
@ -342,14 +342,14 @@ func (self *ChainManager) Export(w io.Writer) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *ChainManager) insert(block *types.Block) {
|
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()...)
|
key := append(blockNumPre, block.Number().Bytes()...)
|
||||||
bc.blockDb.Put(key, bc.lastBlockHash.Bytes())
|
bc.blockDb.Put(key, bc.lastBlockHash.Bytes())
|
||||||
// Push block to cache
|
// Push block to cache
|
||||||
bc.cache.Push(block)
|
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) {
|
func (bc *ChainManager) write(block *types.Block) {
|
||||||
|
|
Loading…
Reference in New Issue