-
-
Notifications
You must be signed in to change notification settings - Fork 291
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: ignore discovered peers with no multiaddrs #5736
Conversation
Performance Report✔️ no performance regression detected 🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
Getting another but similar error running this branch
There is also a max listeners warning, could be related
|
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.
LGTM! 🚀
*/ | ||
private onDiscoveredPeer = (evt: CustomEvent<PeerInfo>): void => { | ||
const {id, multiaddrs} = evt.detail; | ||
|
||
// libp2p may send us PeerInfos without multiaddrs | ||
if (multiaddrs.length === 0) { |
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.
with this error Cannot read properties of undefined (reading '0')
we need to handle undefined multiaddrs
too
if (multiaddrs.length === 0) { | |
if (!multiaddrs || multiaddrs.length === 0) { |
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.
Looks good now, no more errors
🎉 This PR is included in v1.10.0 🎉 |
Motivation
Upgrading to libp2p 0.45.9, it changed how / when it emits
"peer:discovery"
events.Description
Update
onDiscoveredPeer
to handle the case wheremultiaddrs: Multiaddr[]
is empty.