Skip to content

Commit

Permalink
fix: add support for multiaddrs 8.0.0 (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: George Nicolaou <george@silensec.com>

BREAKING CHANGE: emitted peer multiaddrs changed to Uint8Arrays
  • Loading branch information
georgenicolaou authored Oct 7, 2020
1 parent c314f1e commit af65502
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"debug": "^4.1.1",
"emittery": "^0.6.0",
"multiaddr": "^7.4.3",
"multiaddr": "^8.0.0",
"peer-id": "^0.13.11",
"protons": "^1.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class PubsubPeerDiscovery extends Emittery {
_broadcast () {
const peer = {
publicKey: this.libp2p.peerId.pubKey.bytes,
addrs: this.libp2p.multiaddrs.map(ma => ma.buffer)
addrs: this.libp2p.multiaddrs.map(ma => ma.bytes)
}

const encodedPeer = PB.Peer.encode(peer)
Expand Down
4 changes: 2 additions & 2 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Pubsub Peer Discovery', () => {
expect(peerId.equals(mockLibp2p.peerId)).to.equal(true)
expect(peer.addrs).to.have.length(1)
peer.addrs.forEach((addr) => {
expect(addr).to.equalBytes(listeningMultiaddrs.buffer)
expect(addr).to.equalBytes(listeningMultiaddrs.bytes)
})
expect(topic).to.equal(PubsubPeerDiscovery.TOPIC)

Expand All @@ -76,7 +76,7 @@ describe('Pubsub Peer Discovery', () => {
}
const peer = {
publicKey: peerId.pubKey.bytes,
addrs: expectedPeerData.multiaddrs.map(ma => multiaddr(ma).buffer)
addrs: expectedPeerData.multiaddrs.map(ma => multiaddr(ma).bytes)
}

const deferred = defer()
Expand Down

0 comments on commit af65502

Please sign in to comment.