-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
peer: use generic lru #1599
peer: use generic lru #1599
Conversation
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.
OK
I don't see anything wrong with using dcrd modules. Modules are stable and can be used by callers as desired. |
@davecgh did you have any objections of than the go mod tidy (which was done)? If not I'm going to merge this one. |
Since there seemed to be no objections and this is important, merging it in now. |
Actually, @tuxcanfly could you squash this to one commit before I merge? |
I didn't test it, but it reads well enough. |
Will give it a quick test |
847835e
to
a21879e
Compare
Squashed 👍 |
Just a sec, borrowing some updates from @dajohi |
While here, also rename and generalize limitMap and apply to other maps which need to be bounded.
@tuxcanfly just squash it when you are ready for final review/merge/ |
5f21fe3
to
4b3f7f3
Compare
@@ -147,6 +147,25 @@ type peerSyncState struct { | |||
requestedBlocks map[chainhash.Hash]struct{} | |||
} | |||
|
|||
// limitAdd is a helper function for maps that require a maximum limit by |
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.
Does anyone object to this func name? It's called addAndLimitMap
in @dajohi code but I thought it was too verbose.
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.
no objection from me
Squashed again. |
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.
OK
This PR updates
sentNonces
andknownInventory
to use the more generic LRU from Decred. This cuts down the need for maintaining two instances of almost same code i.emruInventoryMap
andmruSentNonces
.