-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(bitswap/message) duplicate entries #216
Conversation
@maybebtc lgtm to use a map to avoid dups, but we still need to send an ordered wantlist (unless we change bitswap protocol to communicate priority another way. a normalized priority value may make sense) (maybe this doesn't change ordering on messages, just not seeing it at a glance) |
cc7ec0f
to
20e799e
Compare
@whyrusleeping noticed this a couple days ago potential long-term fix: prevent duplicate entries in the wantlist by using a map/set and iterating over this data structure on export
implementation will be patched to ensure bitswap messages cannot contain duplicate blocks or keys
A nice invariant for bitswap sessions: Senders and receivers can trust that messages do not contain duplicate blocks or duplicate keys. Backing the message with a map enforces this invariant. This comes at the cost of O(n) getters.
so there's one less name to think about
comes at the cost of O(n) Blocks() method.
to emphasize idempotence
20e799e
to
91a31a3
Compare
ah missed this detail 💡
yup it does 😞 the
Yeah. Let's add it to the pipeline. For now (alpha), let's keep sorted want list. 💡 How about?
code: |
S+LGTM! just make sure to only send the ordered list :) |
fix(bitswap/message) duplicate entries
@whyrusleeping @jbenet