Fixes issue where only wants of type block are stored in peerContext

This commit is contained in:
Ben 2024-10-22 15:02:14 +02:00
parent d6b0de080c
commit 2a254601d9
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
1 changed files with 3 additions and 3 deletions

View File

@ -401,7 +401,8 @@ proc wantListHandler*(
address = e.address address = e.address
wantType = $e.wantType wantType = $e.wantType
if idx < 0: # updating entry if idx < 0: # new entry
peerCtx.peerWants.add(e)
let let
have = await e.address in b.localStore have = await e.address in b.localStore
price = @( price = @(
@ -424,9 +425,8 @@ proc wantListHandler*(
`type`: BlockPresenceType.Have, `type`: BlockPresenceType.Have,
price: price)) price: price))
elif e.wantType == WantType.WantBlock: elif e.wantType == WantType.WantBlock:
peerCtx.peerWants.add(e)
codex_block_exchange_want_block_lists_received.inc() codex_block_exchange_want_block_lists_received.inc()
else: else: # update existing entry
# peer doesn't want this block anymore # peer doesn't want this block anymore
if e.cancel: if e.cancel:
peerCtx.peerWants.del(idx) peerCtx.peerWants.del(idx)