chore: update pubsub implementations (#493)

This commit is contained in:
Vasco Santos 2019-12-03 11:29:20 +01:00 committed by Jacob Heun
parent 8da9fc97d4
commit 9a6e07d70b
4 changed files with 7 additions and 7 deletions

View File

@ -94,8 +94,8 @@
"libp2p-bootstrap": "^0.10.3",
"libp2p-delegated-content-routing": "^0.4.1",
"libp2p-delegated-peer-routing": "^0.4.0",
"libp2p-floodsub": "^0.19.0",
"libp2p-gossipsub": "^0.1.0",
"libp2p-floodsub": "^0.20.0",
"libp2p-gossipsub": "^0.2.0",
"libp2p-kad-dht": "^0.18.0",
"libp2p-mdns": "^0.13.0",
"libp2p-mplex": "^0.9.1",

View File

@ -83,12 +83,12 @@ module.exports = (node, Pubsub, config) => {
* @param {string} topic
* @returns {Array<string>}
*/
getPeersSubscribed: (topic) => {
getSubscribers: (topic) => {
if (!node.isStarted() && !pubsub.started) {
throw errCode(new Error(messages.NOT_STARTED_YET), codes.PUBSUB_NOT_STARTED)
}
return pubsub.getPeersSubscribed(topic)
return pubsub.getSubscribers(topic)
},
setMaxListeners (n) {

View File

@ -85,7 +85,7 @@ describe('Pubsub subsystem is able to use different implementations', () => {
// wait for remoteLibp2p to know about libp2p subscription
await pWaitFor(() => {
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
return subscribedPeers.includes(libp2pId)
})

View File

@ -89,7 +89,7 @@ describe('Pubsub subsystem operates correctly', () => {
// wait for remoteLibp2p to know about libp2p subscription
await pWaitFor(() => {
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
return subscribedPeers.includes(libp2pId)
})
remoteLibp2p.pubsub.publish(topic, data)
@ -172,7 +172,7 @@ describe('Pubsub subsystem operates correctly', () => {
// wait for remoteLibp2p to know about libp2p subscription
await pWaitFor(() => {
const subscribedPeers = remoteLibp2p.pubsub.getPeersSubscribed(topic)
const subscribedPeers = remoteLibp2p.pubsub.getSubscribers(topic)
return subscribedPeers.includes(libp2pId)
})