-
Notifications
You must be signed in to change notification settings - Fork 21
add more error handling for malformed bootstrap multiaddr #74
Conversation
A unit test or two would help. |
@richardschneider good point, went for extending the existing paradigm and added a sample peer list with malformed addresses, PTAL if you don't mind :) |
LGTM |
We should be able to use https://github.com/multiformats/js-mafmt here. I think the @diasdavid do we have any functions anywhere for validating thin-waist formats? |
test/railing.spec.js
Outdated
|
||
r.start(() => {}) | ||
|
||
r.once('peer', (peer) => done()) |
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.
This should check that only valid peers come out.
src/index.js
Outdated
const peerIdB58Str = ma.getPeerId() | ||
if (!peerIdB58Str) { return log.error('Unable to resolve bootstrap peer id') } | ||
|
||
const peerId = PeerId.createFromB58String(peerIdB58Str) |
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.
You can probably simplify this by using mafmt
with a isIPFS
@zcstarr still on top of this one? |
@diasdavid just a heads up, fixed the test timeout. |
The intent here is to allow downstream consumers to just log bad multiaddrs. issue: #44