Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
chore: rename peer-store properties (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Apr 27, 2020
1 parent 42eb5eb commit 1f02658
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"delay": "^4.3.0",
"dirty-chai": "^2.0.1",
"it-pair": "^1.0.0",
"libp2p": "libp2p/js-libp2p#0.28.x",
"libp2p": "libp2p/js-libp2p#chore/rename-peer-store-properties",
"lodash": "^4.17.11",
"lodash.random": "^3.2.0",
"lodash.range": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/content-routing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = (dht) => {
const peerData = dht.peerStore.get(id) || {}
out.push({
id: peerData.id || id,
multiaddrs: (peerData.multiaddrInfos || []).map((mi) => mi.multiaddr)
multiaddrs: (peerData.addresses || []).map((address) => address.multiaddr)
})
})

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class KadDHT extends EventEmitter {

return {
id: p,
multiaddrs: peer ? peer.multiaddrInfos.map((mi) => mi.multiaddr) : []
multiaddrs: peer ? peer.addresses.map((address) => address.multiaddr) : []
}
})
}
Expand Down
8 changes: 4 additions & 4 deletions src/peer-routing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (dht) => {
if (peerData) {
return {
id: peerData.id,
multiaddrs: peerData.multiaddrInfos.map((mi) => mi.multiaddr)
multiaddrs: peerData.addresses.map((address) => address.multiaddr)
}
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ module.exports = (dht) => {
dht._log('found in peerStore')
return {
id: peer.id,
multiaddrs: peer.multiaddrInfos.map((mi) => mi.multiaddr)
multiaddrs: peer.addresses.map((address) => address.multiaddr)
}
}
}
Expand Down Expand Up @@ -195,7 +195,7 @@ module.exports = (dht) => {

return {
id: peerData.id,
multiaddrs: peerData.multiaddrInfos.map((mi) => mi.multiaddr)
multiaddrs: peerData.addresses.map((address) => address.multiaddr)
}
},

Expand Down Expand Up @@ -265,7 +265,7 @@ module.exports = (dht) => {
}

peerData.id = new PeerId(peer.id, null, pk)
const addrs = peerData.multiaddrInfos.map((mi) => mi.multiaddr)
const addrs = peerData.addresses.map((address) => address.multiaddr)
dht.peerStore.addressBook.add(peerData.id, addrs)

return pk
Expand Down
2 changes: 1 addition & 1 deletion test/rpc/handlers/add-provider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('rpc - handlers - AddProvider', () => {
expect(provs[0].id).to.eql(peerIds[0].id)

const bookEntry = dht.peerStore.get(peerIds[0])
expect(bookEntry.multiaddrInfos.map((mi) => mi.multiaddr)).to.eql([ma1])
expect(bookEntry.addresses.map((address) => address.multiaddr)).to.eql([ma1])
})

it('fall back to sender if providers have no multiaddrs', async () => {
Expand Down

0 comments on commit 1f02658

Please sign in to comment.