From 0aea16047c60e8fbed022bc487207cccc0a95f66 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 27 Jun 2023 15:24:29 +0200 Subject: [PATCH] Ignore errors when retrieving block by hash --- ethers/providers/jsonrpc/subscriptions.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethers/providers/jsonrpc/subscriptions.nim b/ethers/providers/jsonrpc/subscriptions.nim index b13fb96..b381219 100644 --- a/ethers/providers/jsonrpc/subscriptions.nim +++ b/ethers/providers/jsonrpc/subscriptions.nim @@ -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: