Skip to content

Commit

Permalink
gpo non-existent block checks
Browse files Browse the repository at this point in the history
  • Loading branch information
zsfelfoldi authored and obscuren committed Jun 29, 2015
1 parent ac80ec5 commit 5d9df73
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions eth/gasprice.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,21 @@ func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle) {
}

func (self *GasPriceOracle) processPastBlocks() {
last := self.chain.CurrentBlock().NumberU64()
first := uint64(0)
last := int64(-1)
cblock := self.chain.CurrentBlock()
if cblock != nil {
last = int64(cblock.NumberU64())
}
first := int64(0)
if last > gpoProcessPastBlocks {
first = last - gpoProcessPastBlocks
}
self.firstProcessed = first
self.firstProcessed = uint64(first)
for i := first; i <= last; i++ {
self.processBlock(self.chain.GetBlockByNumber(i))
block := self.chain.GetBlockByNumber(uint64(i))
if block != nil {
self.processBlock(block)
}
}

}
Expand Down

0 comments on commit 5d9df73

Please sign in to comment.