Skip to content

Commit

Permalink
chore: fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed May 10, 2023
1 parent bb7810b commit cadfaf4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 66 deletions.
79 changes: 18 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@
"@dapplion/benchmark": "^0.2.2",
"@libp2p/floodsub": "^7.0.1",
"@libp2p/interface-libp2p": "^3.1.0",
"@libp2p/interface-mocks": "^12.0.0",
"@libp2p/interface-mocks": "^12.0.1",
"@libp2p/interface-pubsub-compliance-tests": "^5.0.0",
"@libp2p/peer-id-factory": "^2.0.0",
"@libp2p/peer-store": "^8.1.0",
"@libp2p/peer-store": "^8.1.2",
"@types/node": "^17.0.21",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
Expand Down
14 changes: 11 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import { InboundStream, OutboundStream } from './stream.js'
import { Uint8ArrayList } from 'uint8arraylist'
import { decodeRpc, DecodeRPCLimits, defaultDecodeRpcLimits } from './message/decodeRpc.js'
import { ConnectionManager } from '@libp2p/interface-connection-manager'
import { PeerStore } from '@libp2p/interface-peer-store'
import { Peer, PeerStore } from '@libp2p/interface-peer-store'
import { Multiaddr } from '@multiformats/multiaddr'
import { multiaddrToIPStr } from './utils/multiaddr.js'

Expand Down Expand Up @@ -2428,11 +2428,19 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements PubSub<G
// unsigned address records through PX anyways
// Finding signed records in the DHT is not supported at the time of writing in js-libp2p
const id = peerIdFromString(peerId)
const peerInfo = await this.components.peerStore.get(id)
let peerInfo: Peer | undefined

try {
peerInfo = await this.components.peerStore.get(id)
} catch (err: any) {
if (err.code !== 'ERR_NOT_FOUND') {
throw err
}
}

return {
peerID: id.toBytes(),
signedPeerRecord: peerInfo.peerRecordEnvelope
signedPeerRecord: peerInfo?.peerRecordEnvelope
}
})
)
Expand Down

0 comments on commit cadfaf4

Please sign in to comment.