fix: peer-exchange go-waku interop (#1300)

* merge: master

* fix: CI

* use: js script instead of shell script to run precheck and mocha

* check for peer id instead of ws multiaddr in response
This commit is contained in:
Danish Arora 2023-04-19 13:07:29 +05:30 committed by GitHub
parent 306e38ba14
commit b7d4b675bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -9,11 +9,9 @@ const WAKUNODE_IMAGE =
async function main() {
try {
await execAsync(`docker inspect ${WAKUNODE_IMAGE}`);
console.log("Using local image");
} catch (error) {
console.log("Pulling image...");
await execAsync(`docker pull ${WAKUNODE_IMAGE}`);
console.log("Image pulled");
}

View File

@ -92,7 +92,7 @@ describe("Peer Exchange", () => {
discv5BootstrapNode: enr,
});
const nwaku1Ma = await nwaku1.getMultiaddrWithId();
const nwaku1PeerId = await nwaku1.getPeerId();
const nwaku2Ma = await nwaku2.getMultiaddrWithId();
waku = await createLightNode();
@ -130,14 +130,12 @@ describe("Peer Exchange", () => {
expect(peerInfos.length).to.be.lessThanOrEqual(numPeersToRequest);
expect(peerInfos[0].ENR).to.not.be.null;
const doesMultiaddrExist =
const doesPeerIdExistInResponse =
peerInfos.find(
(peerInfo) =>
peerInfo.ENR?.getFullMultiaddrs()?.find((multiaddr) =>
multiaddr.equals(nwaku1Ma)
) !== undefined
({ ENR }) => ENR?.peerInfo?.id.toString() === nwaku1PeerId.toString()
) !== undefined;
expect(doesMultiaddrExist).to.be.equal(true);
expect(doesPeerIdExistInResponse).to.be.equal(true);
expect(waku.libp2p.peerStore.has(await nwaku2.getPeerId())).to.be.true;
});