-
Notifications
You must be signed in to change notification settings - Fork 47
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
refactor: use peerInfo and multiaddresses instead of peerID #1269
base: master
Are you sure you want to change the base?
Conversation
1ed0036
to
498022a
Compare
498022a
to
953a82a
Compare
953a82a
to
bf357f2
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.
LGTM! Thanks for it! 💯
Just one nitpick comment
@@ -352,7 +352,7 @@ func AddPeer(instance *WakuInstance, address string, protocolID string) (string, | |||
return "", err | |||
} | |||
|
|||
peerID, err := instance.node.AddPeer(ma, peerstore.Static, instance.relayTopics, libp2pProtocol.ID(protocolID)) | |||
peerID, err := instance.node.AddPeer([]multiaddr.Multiaddr{ma}, peerstore.Static, instance.relayTopics, libp2pProtocol.ID(protocolID)) |
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.
Would it be possible to avoid that "cast" , []multiaddr.Multiaddr{...}
? Maybe we can make it once within the AddPeer
func.
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.
Changes LGTM
Required by status-im/status-go#5946
The interaction with libwaku is done thru multiaddresses instead of peerID, because the peerstore is not exposed like we do in go-waku. So, to make it possible to use both go-waku and nwaku in status-go (depending on a build flag), changes are done both in go-waku and the
api
package to use multiaddresses and/or peer.AddrInfo where needed.It's worth mentioning that the cases in which a
peer.AddrInfo
are those in which a node can have more than one multiaddress (like the storenodes), and in these cases thepeer.AddrInfo
will be translated into a comma separated string containing all the multiaddresses like it is done here: https://github.com/status-im/status-go/blob/1348510acfdfd93dbe5fc5b0a23e9caf532272a3/wakuv2/nwaku.go#L2904-L2910This PR should not be merged until status-im/status-go#5946 is ready to be merged
cc: @Ivansete-status @gabrielmer