-
Notifications
You must be signed in to change notification settings - Fork 445
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
chore: store self protocols in protobook #760
Conversation
d42da6c
to
f6ccca0
Compare
8f40eb6
to
72fe150
Compare
f6ccca0
to
a263547
Compare
628cbce
to
24a16df
Compare
24a16df
to
bb6e463
Compare
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.
overall looks good, just some nits in the tests
test/peer-store/proto-book.spec.js
Outdated
if (changeTrigger === 0 && arraysAreEqual(protocols, finalProtocols)) { | ||
defer.resolve() | ||
} | ||
}) |
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.
just a nit, you could pass a sinon spy as the event handler, then you could validate the emitted data after each update. Then you dont have to deal with the trigger counter.
test/peer-store/proto-book.spec.js
Outdated
// Wait 50ms for incorrect second event | ||
setTimeout(() => { | ||
defer.resolve() | ||
}, 50) |
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.
spy as the handler would also avoid you needing to use a timeout here
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
106ddfa
to
102ccd3
Compare
This PR stores the self protocols in the Protobook on
handle
/unhandle
.This allows the identify service to be consistent, by tracking self protocols change in the same way as #748 does for multiaddrs.
Protobook.remove
API method was added for the unhandle.Needs: