mirror of https://github.com/status-im/op-geth.git
core: changed how head events are checked
This commit is contained in:
parent
580bae0a86
commit
0f76a1c6df
|
@ -593,7 +593,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
|
||||||
self.setTransState(state.New(block.Root(), self.stateDb))
|
self.setTransState(state.New(block.Root(), self.stateDb))
|
||||||
self.txState.SetState(state.New(block.Root(), self.stateDb))
|
self.txState.SetState(state.New(block.Root(), self.stateDb))
|
||||||
|
|
||||||
queue[i] = ChainEvent{block, logs}
|
queue[i] = ChainEvent{block, block.Hash(), logs}
|
||||||
queueEvent.canonicalCount++
|
queueEvent.canonicalCount++
|
||||||
|
|
||||||
if glog.V(logger.Debug) {
|
if glog.V(logger.Debug) {
|
||||||
|
@ -683,7 +683,7 @@ out:
|
||||||
case ChainEvent:
|
case ChainEvent:
|
||||||
// We need some control over the mining operation. Acquiring locks and waiting for the miner to create new block takes too long
|
// We need some control over the mining operation. Acquiring locks and waiting for the miner to create new block takes too long
|
||||||
// and in most cases isn't even necessary.
|
// and in most cases isn't even necessary.
|
||||||
if i+1 == ev.canonicalCount {
|
if self.lastBlockHash == event.Hash {
|
||||||
self.currentGasLimit = CalcGasLimit(event.Block)
|
self.currentGasLimit = CalcGasLimit(event.Block)
|
||||||
self.eventMux.Post(ChainHeadEvent{event.Block})
|
self.eventMux.Post(ChainHeadEvent{event.Block})
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package core
|
||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
)
|
)
|
||||||
|
@ -27,6 +28,7 @@ type ChainSplitEvent struct {
|
||||||
|
|
||||||
type ChainEvent struct {
|
type ChainEvent struct {
|
||||||
Block *types.Block
|
Block *types.Block
|
||||||
|
Hash common.Hash
|
||||||
Logs state.Logs
|
Logs state.Logs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue