mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-10 21:15:59 +00:00
Fixes issue where peerWants are only stored for type wantBlock.
This commit is contained in:
parent
7c2bff79c0
commit
64e691b824
@ -399,7 +399,9 @@ 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 = @(
|
||||||
@ -408,6 +410,8 @@ proc wantListHandler*(
|
|||||||
|
|
||||||
if e.wantType == WantType.WantHave:
|
if e.wantType == WantType.WantHave:
|
||||||
codex_block_exchange_want_have_lists_received.inc()
|
codex_block_exchange_want_have_lists_received.inc()
|
||||||
|
elif e.wantType == WantType.WantBlock:
|
||||||
|
codex_block_exchange_want_block_lists_received.inc()
|
||||||
|
|
||||||
if not have and e.sendDontHave:
|
if not have and e.sendDontHave:
|
||||||
presence.add(
|
presence.add(
|
||||||
@ -421,10 +425,8 @@ proc wantListHandler*(
|
|||||||
address: e.address,
|
address: e.address,
|
||||||
`type`: BlockPresenceType.Have,
|
`type`: BlockPresenceType.Have,
|
||||||
price: price))
|
price: price))
|
||||||
elif e.wantType == WantType.WantBlock:
|
|
||||||
peerCtx.peerWants.add(e)
|
else: # update existing entry
|
||||||
codex_block_exchange_want_block_lists_received.inc()
|
|
||||||
else:
|
|
||||||
# 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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user