Skip to content

Commit 24e54be

Browse files
committed
support finalized tag in eth_feeHistory
1 parent 18cfdaf commit 24e54be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

eth/gasprice/feehistory.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ func (oracle *Oracle) resolveBlockRange(ctx context.Context, lastBlock rpc.Block
170170
} else if pendingBlock == nil && lastBlock > headBlock {
171171
return nil, nil, 0, 0, fmt.Errorf("%w: requested %d, head %d", errRequestBeyondHead, lastBlock, headBlock)
172172
}
173+
if lastBlock == rpc.FinalizedBlockNumber {
174+
if latestFinalizedHeader, err := oracle.backend.HeaderByNumber(ctx, rpc.FinalizedBlockNumber); err == nil {
175+
lastBlock = rpc.BlockNumber(latestFinalizedHeader.Number.Uint64())
176+
} else {
177+
return nil, nil, 0, 0, err
178+
}
179+
}
173180
// ensure not trying to retrieve before genesis
174181
if rpc.BlockNumber(blocks) > lastBlock+1 {
175182
blocks = int(lastBlock + 1)

0 commit comments

Comments
 (0)