From 0bd2fabaa438e70032e109975c1bf4f7b4d82583 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Fri, 7 Oct 2022 00:04:01 +0200 Subject: [PATCH] fix crash when can't find a CID and timeout hits the exception was not raised, thus a Nil was returned that was than wrapped in an option, leading to crash. Signed-off-by: Csaba Kiraly --- codex/blockexchange/engine/pendingblocks.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codex/blockexchange/engine/pendingblocks.nim b/codex/blockexchange/engine/pendingblocks.nim index c24c7519..6f3be6d5 100644 --- a/codex/blockexchange/engine/pendingblocks.nim +++ b/codex/blockexchange/engine/pendingblocks.nim @@ -48,6 +48,8 @@ proc getWantHandle*( raise exc except CatchableError as exc: trace "Pending WANT failed or expired", exc = exc.msg + # no need to cancel, it is already cancelled by wait() + raise exc finally: p.blocks.del(cid)