Skip to content

Commit

Permalink
feat: update dht (#384)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: uses 0.26.x of libp2p-kad-dht
  • Loading branch information
achingbrain authored Nov 22, 2021
1 parent 8daf48e commit 8d96a18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"iso-random-stream": "^2.0.0",
"it-all": "^1.0.5",
"it-drain": "^1.0.4",
"libp2p": "^0.32.4",
"libp2p-kad-dht": "^0.24.1",
"libp2p": "libp2p/js-libp2p#feat/update-dht",
"libp2p-kad-dht": "^0.26.1",
"libp2p-mplex": "^0.10.2",
"libp2p-tcp": "^0.17.1",
"lodash.difference": "^4.5.0",
Expand Down
13 changes: 9 additions & 4 deletions test/bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ import { BitswapMessage as Message } from '../src/message/index.js'
*/
async function createThing (dht) {
const libp2pNode = await createLibp2pNode({
DHT: dht
DHT: dht,
config: {
dht: {
clientMode: false
}
}
})
const bitswap = new Bitswap(libp2pNode, new MemoryBlockstore())
bitswap.start()
Expand Down Expand Up @@ -182,9 +187,9 @@ describe('bitswap with DHT', function () {

// await dht routing table are updated
await Promise.all([
pWaitFor(() => nodes[0].libp2pNode._dht.routingTable.size >= 1),
pWaitFor(() => nodes[1].libp2pNode._dht.routingTable.size >= 2),
pWaitFor(() => nodes[2].libp2pNode._dht.routingTable.size >= 1)
pWaitFor(() => nodes[0].libp2pNode._dht._lan._routingTable.size >= 1),
pWaitFor(() => nodes[1].libp2pNode._dht._lan._routingTable.size >= 2),
pWaitFor(() => nodes[2].libp2pNode._dht._lan._routingTable.size >= 1)
])
})

Expand Down

0 comments on commit 8d96a18

Please sign in to comment.