-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup blockexchange blockAddress handling #1051
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,19 +130,6 @@ iterator wantList*(p: PendingBlocksManager): BlockAddress = | |
for a in p.blocks.keys: | ||
yield a | ||
|
||
iterator wantListBlockCids*(p: PendingBlocksManager): Cid = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is the actual dead code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, unused code. |
||
for a in p.blocks.keys: | ||
if not a.leaf: | ||
yield a.cid | ||
|
||
iterator wantListCids*(p: PendingBlocksManager): Cid = | ||
var yieldedCids = initHashSet[Cid]() | ||
for a in p.blocks.keys: | ||
let cid = a.cidOrTreeCid | ||
if cid notin yieldedCids: | ||
yieldedCids.incl(cid) | ||
yield cid | ||
|
||
iterator wantHandles*(p: PendingBlocksManager): Future[Block] = | ||
for v in p.blocks.values: | ||
yield v.handle | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,12 +38,6 @@ type | |
proc peerHave*(self: BlockExcPeerCtx): seq[BlockAddress] = | ||
toSeq(self.blocks.keys) | ||
|
||
proc peerHaveCids*(self: BlockExcPeerCtx): HashSet[Cid] = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this 🙂 |
||
self.blocks.keys.toSeq.mapIt(it.cidOrTreeCid).toHashSet | ||
|
||
proc peerWantsCids*(self: BlockExcPeerCtx): HashSet[Cid] = | ||
self.peerWants.mapIt(it.address.cidOrTreeCid).toHashSet | ||
|
||
proc contains*(self: BlockExcPeerCtx, address: BlockAddress): bool = | ||
address in self.blocks | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trusting those two things are the same....