Skip to content

Commit

Permalink
no need to store everything in peerStore (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 authored Jan 13, 2025
1 parent 0bd7079 commit 1badd40
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/components/P2P/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,10 @@ export class OceanP2P extends EventEmitter {
P2P_LOGGER.debug('Connection closed to:' + peerId.toString()) // Emitted when a peer has been found
}

async handlePeerDiscovery(details: any) {
handlePeerDiscovery(details: any) {
try {
const peerInfo = details.detail
// P2P_LOGGER.debug('Discovered new peer:' + peerInfo.id.toString())
if (peerInfo.multiaddrs) {
await this._libp2p.peerStore.save(peerInfo.id, {
multiaddrs: peerInfo.multiaddrs
})
await this._libp2p.peerStore.patch(peerInfo.id, {
multiaddrs: peerInfo.multiaddrs
})
}
P2P_LOGGER.debug('Discovered new peer:' + peerInfo.id.toString())
} catch (e) {
// no panic if it failed
// console.error(e)
Expand Down

0 comments on commit 1badd40

Please sign in to comment.