diff --git a/src/core/components/libp2p.js b/src/core/components/libp2p.js index 2a5a4a9b6a..7fc21bc922 100644 --- a/src/core/components/libp2p.js +++ b/src/core/components/libp2p.js @@ -19,9 +19,12 @@ module.exports = function libp2p (self, config) { const libp2p = createBundle({ options, config, datastore, peerInfo, peerBook }) let discoveredPeers = [] + const noop = () => {} const putAndDial = peerInfo => { - peerBook.put(peerInfo) - libp2p.dial(peerInfo, () => {}) + peerInfo = peerBook.put(peerInfo) + if (!peerInfo.isConnected()) { + libp2p.dial(peerInfo, noop) + } } libp2p.on('start', () => {