From 291e79fc993f28d3a25271896192c670ab64ba0f Mon Sep 17 00:00:00 2001 From: David Dias Date: Wed, 29 Mar 2017 21:02:37 +0100 Subject: [PATCH] fix: addition of ipfs id appendix must come before transport filtering --- src/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 7b85a7da2f..113d899899 100644 --- a/src/index.js +++ b/src/index.js @@ -93,6 +93,15 @@ class Node extends EventEmitter { let transports = this.modules.transport transports = Array.isArray(transports) ? transports : [transports] + + // so that we can have webrtc-star addrs without adding manually the id + this.peerInfo.multiaddrs = this.peerInfo.multiaddrs.map((ma) => { + if (!mafmt.IPFS.matches(ma)) { + ma = ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String()) + } + return ma + }) + const multiaddrs = this.peerInfo.multiaddrs transports.forEach((transport) => { @@ -107,13 +116,6 @@ class Node extends EventEmitter { } }) - // so that we can have webrtc-star addrs without adding manually the id - this.peerInfo.multiaddrs = this.peerInfo.multiaddrs.map((ma) => { - if (!mafmt.IPFS.matches(ma)) { - ma = ma.encapsulate('/ipfs/' + this.peerInfo.id.toB58String()) - } - }) - this.swarm.listen((err) => { if (err) { return callback(err)