Ignore errors when retrieving block by hash

This commit is contained in:
Mark Spanbroek 2023-06-27 15:24:29 +02:00 committed by markspanbroek
parent 76bd3090d1
commit 0aea16047c
1 changed files with 5 additions and 2 deletions

View File

@ -132,8 +132,11 @@ method subscribeBlocks(subscriptions: PollingSubscriptions,
{.async.} =
proc getBlock(hash: BlockHash) {.async.} =
if blck =? (await subscriptions.client.eth_getBlockByHash(hash, false)):
await onBlock(blck)
try:
if blck =? (await subscriptions.client.eth_getBlockByHash(hash, false)):
await onBlock(blck)
except CatchableError:
discard
proc callback(id, change: JsonNode) =
if hash =? BlockHash.fromJson(change).catch: