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)