mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
fix for glsfunc==nil
This commit is contained in:
parent
9b904067b0
commit
484ba531d4
1 changed files with 10 additions and 2 deletions
|
|
@ -142,6 +142,14 @@ func NewChainManager(blockDb, stateDb, extraDb common.Database, pow pow.PoW, mux
|
|||
return bc, nil
|
||||
}
|
||||
|
||||
func (bc *ChainManager) evalGlsFunc(parent *types.Block) *big.Int {
|
||||
if bc.glsfunc == nil {
|
||||
return parent.GasLimit()
|
||||
} else {
|
||||
return bc.glsfunc(parent)
|
||||
}
|
||||
}
|
||||
|
||||
func (bc *ChainManager) SetHead(head *types.Block) {
|
||||
bc.mu.Lock()
|
||||
defer bc.mu.Unlock()
|
||||
|
|
@ -239,7 +247,7 @@ func (bc *ChainManager) setLastState() error {
|
|||
bc.Reset()
|
||||
}
|
||||
bc.td = bc.currentBlock.Td
|
||||
bc.currentGasLimit = bc.glsfunc(bc.currentBlock)
|
||||
bc.currentGasLimit = bc.evalGlsFunc(bc.currentBlock)
|
||||
|
||||
if glog.V(logger.Info) {
|
||||
glog.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)
|
||||
|
|
@ -761,7 +769,7 @@ out:
|
|||
// 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 self.lastBlockHash == event.Hash {
|
||||
self.currentGasLimit = self.glsfunc(event.Block)
|
||||
self.currentGasLimit = self.evalGlsFunc(event.Block)
|
||||
self.eventMux.Post(ChainHeadEvent{event.Block})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue