From 696f2a9677f06575530f5d79ad8c10851f69ffa1 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Wed, 13 Feb 2019 16:50:17 +0000 Subject: [PATCH] fix: remove ipfs from identify multiaddrs --- src/daemon.js | 4 +++- test/daemon.spec.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/daemon.js b/src/daemon.js index 93541626..09ff1aad 100644 --- a/src/daemon.js +++ b/src/daemon.js @@ -366,7 +366,9 @@ class Daemon { enc.write(OkResponse({ identify: { id: this.libp2p.peerInfo.id.toBytes(), - addrs: this.libp2p.peerInfo.multiaddrs.toArray().map(m => m.buffer) + // temporary removal of "/ipfs/..." from multiaddrs + // this will be solved in: https://github.com/libp2p/js-libp2p/issues/323 + addrs: this.libp2p.peerInfo.multiaddrs.toArray().map(m => m.decapsulate('ipfs').buffer) } })) break diff --git a/test/daemon.spec.js b/test/daemon.spec.js index d3a3ada9..f6a9c853 100644 --- a/test/daemon.spec.js +++ b/test/daemon.spec.js @@ -143,9 +143,10 @@ describe('daemon', () => { const response = Response.decode(await stream.first()) expect(response.type).to.eql(Response.Type.OK) + expect(response.identify).to.eql({ id: daemon.libp2p.peerInfo.id.toBytes(), - addrs: daemon.libp2p.peerInfo.multiaddrs.toArray().map(m => m.buffer) + addrs: daemon.libp2p.peerInfo.multiaddrs.toArray().map(m => m.decapsulate('ipfs').buffer) }) stream.end() })