From dbb9e573114de0c6a9b7b5a694d2e9f478d3aab1 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Tue, 3 Dec 2019 11:29:20 +0100 Subject: [PATCH] chore: update pubsub implementations (#493) --- package.json | 4 ++-- src/pubsub.js | 4 ++-- test/pubsub/implementations.node.js | 2 +- test/pubsub/operation.node.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index be3948ca35..755088762d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/pubsub.js b/src/pubsub.js index 2c067d993d..3f62358672 100644 --- a/src/pubsub.js +++ b/src/pubsub.js @@ -83,12 +83,12 @@ module.exports = (node, Pubsub, config) => { * @param {string} topic * @returns {Array} */ - 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) { diff --git a/test/pubsub/implementations.node.js b/test/pubsub/implementations.node.js index ef2e56fff1..d0edfff6d7 100644 --- a/test/pubsub/implementations.node.js +++ b/test/pubsub/implementations.node.js @@ -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) }) diff --git a/test/pubsub/operation.node.js b/test/pubsub/operation.node.js index 3b41aa6dd8..6344868e01 100644 --- a/test/pubsub/operation.node.js +++ b/test/pubsub/operation.node.js @@ -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) })