@@ -137,7 +137,7 @@ func (oracle *Oracle) processBlock(bf *blockFees, percentiles []float64) {
137137// also returned if requested and available.
138138// Note: an error is only returned if retrieving the head header has failed. If there are no
139139// retrievable blocks in the specified range then zero block count is returned with no error.
140- func (oracle * Oracle ) resolveBlockRange (ctx context.Context , reqEnd rpc.BlockNumber , blocks int ) (* types.Block , []* types.Receipt , uint64 , int , error ) {
140+ func (oracle * Oracle ) resolveBlockRange (ctx context.Context , reqEnd rpc.BlockNumber , blocks uint64 ) (* types.Block , []* types.Receipt , uint64 , uint64 , error ) {
141141 var (
142142 headBlock * types.Header
143143 pendingBlock * types.Block
@@ -193,8 +193,8 @@ func (oracle *Oracle) resolveBlockRange(ctx context.Context, reqEnd rpc.BlockNum
193193 return nil , nil , 0 , 0 , nil
194194 }
195195 // Ensure not trying to retrieve before genesis.
196- if int (reqEnd + 1 ) < blocks {
197- blocks = int (reqEnd + 1 )
196+ if uint64 (reqEnd + 1 ) < blocks {
197+ blocks = uint64 (reqEnd + 1 )
198198 }
199199 return pendingBlock , pendingReceipts , uint64 (reqEnd ), blocks , nil
200200}
@@ -213,7 +213,7 @@ func (oracle *Oracle) resolveBlockRange(ctx context.Context, reqEnd rpc.BlockNum
213213//
214214// Note: baseFee includes the next block after the newest of the returned range, because this
215215// value can be derived from the newest block.
216- func (oracle * Oracle ) FeeHistory (ctx context.Context , blocks int , unresolvedLastBlock rpc.BlockNumber , rewardPercentiles []float64 ) (* big.Int , [][]* big.Int , []* big.Int , []float64 , error ) {
216+ func (oracle * Oracle ) FeeHistory (ctx context.Context , blocks uint64 , unresolvedLastBlock rpc.BlockNumber , rewardPercentiles []float64 ) (* big.Int , [][]* big.Int , []* big.Int , []float64 , error ) {
217217 if blocks < 1 {
218218 return common .Big0 , nil , nil , nil , nil // returning with no data and no error means there are no retrievable blocks
219219 }
@@ -242,7 +242,7 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLast
242242 if err != nil || blocks == 0 {
243243 return common .Big0 , nil , nil , nil , err
244244 }
245- oldestBlock := lastBlock + 1 - uint64 ( blocks )
245+ oldestBlock := lastBlock + 1 - blocks
246246
247247 var (
248248 next = oldestBlock
@@ -252,7 +252,7 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLast
252252 for i , p := range rewardPercentiles {
253253 binary .LittleEndian .PutUint64 (percentileKey [i * 8 :(i + 1 )* 8 ], math .Float64bits (p ))
254254 }
255- for i := 0 ; i < maxBlockFetchers && i < blocks ; i ++ {
255+ for i := 0 ; i < maxBlockFetchers && i < int ( blocks ) ; i ++ {
256256 go func () {
257257 for {
258258 // Retrieve the next block number to fetch with this goroutine
@@ -310,7 +310,7 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLast
310310 if fees .err != nil {
311311 return common .Big0 , nil , nil , nil , fees .err
312312 }
313- i := int ( fees .blockNumber - oldestBlock )
313+ i := fees .blockNumber - oldestBlock
314314 if fees .results .baseFee != nil {
315315 reward [i ], baseFee [i ], baseFee [i + 1 ], gasUsedRatio [i ] = fees .results .reward , fees .results .baseFee , fees .results .nextBaseFee , fees .results .gasUsedRatio
316316 } else {
0 commit comments