-
Notifications
You must be signed in to change notification settings - Fork 110
Conversation
If the common factory creates a node with no bootstrap nodes then getting a list of swarm addresses could be empty (or could also be empty anyway if the connection to the bootstrap nodes takes a long time). This PR spawns and connects another IPFS node to ensure that there should be swarm addresses available. License: MIT Signed-off-by: Alan Shaw <[email protected]>
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! Just pointed out a minor detail!
src/swarm/addrs.js
Outdated
}) | ||
}) | ||
}) | ||
|
||
after((done) => common.teardown(done)) | ||
|
||
it('should get a list of node addresses', (done) => { | ||
ipfs.swarm.addrs((err, multiaddrs) => { | ||
ipfsA.swarm.addrs((err, multiaddrs) => { |
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.
Should we change multiaddrs
to peers
or peersInfo
?
I was not understanding the forEach
validation, but after getting into the code, I noticed that in fact ipfs.swarm.addrs()
returns an array of PeerInfo
. This way, calling this multiaddrs
seems confusing. I think we should also update in the SPEC
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.
I changed to peerInfos
as there's already precedent for that name in swarm.peers
docs.
License: MIT Signed-off-by: Alan Shaw <[email protected]>
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!
If the common factory creates a node with no bootstrap nodes then getting a list of swarm addresses could be empty (or could also be empty anyway if the connection to the bootstrap nodes takes a long time). This PR spawns and connects another IPFS node to ensure that there should be swarm addresses available.