do not crash when we cannot get block number
Co-Authored-By: Eric <5089238+emizzle@users.noreply.github.com>
This commit is contained in:
parent
35aebdb46f
commit
e9d862ceca
|
@ -240,11 +240,15 @@ proc confirm*(
|
|||
var blockNumber: UInt256
|
||||
let blockEvent = newAsyncEvent()
|
||||
|
||||
proc updateBlockNumber {.async: (raises: [ProviderError]).} =
|
||||
let number = await tx.provider.getBlockNumber()
|
||||
if number > blockNumber:
|
||||
blockNumber = number
|
||||
blockEvent.fire()
|
||||
proc updateBlockNumber {.async: (raises: []).} =
|
||||
try:
|
||||
let number = await tx.provider.getBlockNumber()
|
||||
if number > blockNumber:
|
||||
blockNumber = number
|
||||
blockEvent.fire()
|
||||
except ProviderError:
|
||||
# there's nothing we can do here
|
||||
discard
|
||||
|
||||
proc onBlock(_: Block) =
|
||||
# ignore block parameter; hardhat may call this with pending blocks
|
||||
|
|
Loading…
Reference in New Issue