From 2a254601d97825f686a2d6f4f435ca7871425509 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 22 Oct 2024 15:02:14 +0200 Subject: [PATCH] Fixes issue where only wants of type block are stored in peerContext --- codex/blockexchange/engine/engine.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codex/blockexchange/engine/engine.nim b/codex/blockexchange/engine/engine.nim index 41605660..4b050210 100644 --- a/codex/blockexchange/engine/engine.nim +++ b/codex/blockexchange/engine/engine.nim @@ -401,7 +401,8 @@ proc wantListHandler*( address = e.address wantType = $e.wantType - if idx < 0: # updating entry + if idx < 0: # new entry + peerCtx.peerWants.add(e) let have = await e.address in b.localStore price = @( @@ -424,9 +425,8 @@ proc wantListHandler*( `type`: BlockPresenceType.Have, price: price)) elif e.wantType == WantType.WantBlock: - peerCtx.peerWants.add(e) codex_block_exchange_want_block_lists_received.inc() - else: + else: # update existing entry # peer doesn't want this block anymore if e.cancel: peerCtx.peerWants.del(idx)