diff --git a/core/chain_manager.go b/core/chain_manager.go index 9f6d7f823532a5b46fa74b29f2efe036014d9888..2c96c243c7dee9e39e58fe8bc3fc5ba6556be8b0 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -593,7 +593,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { self.setTransState(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++ if glog.V(logger.Debug) { @@ -683,7 +683,7 @@ out: case ChainEvent: // 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. - if i+1 == ev.canonicalCount { + if self.lastBlockHash == event.Hash { self.currentGasLimit = CalcGasLimit(event.Block) self.eventMux.Post(ChainHeadEvent{event.Block}) } diff --git a/core/events.go b/core/events.go index 1ea35c2f49b7df6e3c7a5244e37834191d4a8f13..7b56f8bb65ba3c490ec8cf3dd3a605a403be2ad8 100644 --- a/core/events.go +++ b/core/events.go @@ -3,6 +3,7 @@ package core import ( "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" ) @@ -27,6 +28,7 @@ type ChainSplitEvent struct { type ChainEvent struct { Block *types.Block + Hash common.Hash Logs state.Logs }