Skip to content

Commit 1478a37

Browse files
Merge pull request #551 from yaroslavyaroslav/hotfix/oracle-legacy-crash
2 parents f243603 + 5a45c22 commit 1478a37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/web3swift/Web3/Web3+GasOracle.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ extension Web3 {
128128
case let .exact(number): latestBlockNumber = number
129129
}
130130

131-
guard latestBlockNumber != 0 else { return [] }
131+
/// checking if latest block number is greather than number of blocks to take in account
132+
/// we're ignoring case when `latestBlockNumber` == `blockCount` since it's unlikely case
133+
/// which we could neglect
134+
guard latestBlockNumber > blockCount else { return [] }
132135

133136
// TODO: Make me work with cache
134137
let lastNthBlockGasPrice = try (latestBlockNumber - blockCount ... latestBlockNumber)

0 commit comments

Comments
 (0)