Skip to content

Commit

Permalink
Fixes issue where only wants of type block are stored in peerContext
Browse files Browse the repository at this point in the history
  • Loading branch information
benbierens committed Oct 22, 2024
1 parent d6b0de0 commit 2a25460
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions codex/blockexchange/engine/engine.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 = @(
Expand All @@ -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)
Expand Down

0 comments on commit 2a25460

Please sign in to comment.