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
|
var blockNumber: UInt256
|
||||||
let blockEvent = newAsyncEvent()
|
let blockEvent = newAsyncEvent()
|
||||||
|
|
||||||
proc updateBlockNumber {.async: (raises: [ProviderError]).} =
|
proc updateBlockNumber {.async: (raises: []).} =
|
||||||
|
try:
|
||||||
let number = await tx.provider.getBlockNumber()
|
let number = await tx.provider.getBlockNumber()
|
||||||
if number > blockNumber:
|
if number > blockNumber:
|
||||||
blockNumber = number
|
blockNumber = number
|
||||||
blockEvent.fire()
|
blockEvent.fire()
|
||||||
|
except ProviderError:
|
||||||
|
# there's nothing we can do here
|
||||||
|
discard
|
||||||
|
|
||||||
proc onBlock(_: Block) =
|
proc onBlock(_: Block) =
|
||||||
# ignore block parameter; hardhat may call this with pending blocks
|
# ignore block parameter; hardhat may call this with pending blocks
|
||||||
|
|
Loading…
Reference in New Issue