mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-27 12:45:21 +00:00
fix: ensure that websocket multiaddrs are returned from ENR (#1275)
Closes: #1271 Co-authored-by: Danish Arora <35004822+danisharora099@users.noreply.github.com>
This commit is contained in:
parent
c68f29adc3
commit
94940411b0
@ -311,6 +311,9 @@ describe("ENR", function () {
|
|||||||
const ip6 = "::1";
|
const ip6 = "::1";
|
||||||
const tcp = 8080;
|
const tcp = 8080;
|
||||||
const udp = 8080;
|
const udp = 8080;
|
||||||
|
const wsMultiaddr = multiaddr(
|
||||||
|
"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/8000/wss"
|
||||||
|
);
|
||||||
let peerId: PeerId;
|
let peerId: PeerId;
|
||||||
let enr: ENR;
|
let enr: ENR;
|
||||||
|
|
||||||
@ -323,6 +326,7 @@ describe("ENR", function () {
|
|||||||
enr.udp = udp;
|
enr.udp = udp;
|
||||||
enr.tcp6 = tcp;
|
enr.tcp6 = tcp;
|
||||||
enr.udp6 = udp;
|
enr.udp6 = udp;
|
||||||
|
enr.multiaddrs = [wsMultiaddr];
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should properly create location multiaddrs - udp4", () => {
|
it("should properly create location multiaddrs - udp4", () => {
|
||||||
@ -391,7 +395,7 @@ describe("ENR", function () {
|
|||||||
const peerInfo = enr.peerInfo!;
|
const peerInfo = enr.peerInfo!;
|
||||||
console.log(peerInfo);
|
console.log(peerInfo);
|
||||||
expect(peerInfo.id.toString()).to.equal(peerId.toString());
|
expect(peerInfo.id.toString()).to.equal(peerId.toString());
|
||||||
expect(peerInfo.multiaddrs.length).to.equal(4);
|
expect(peerInfo.multiaddrs.length).to.equal(5);
|
||||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||||
multiaddr(`/ip4/${ip4}/tcp/${tcp}`).toString()
|
multiaddr(`/ip4/${ip4}/tcp/${tcp}`).toString()
|
||||||
);
|
);
|
||||||
@ -404,6 +408,9 @@ describe("ENR", function () {
|
|||||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||||
multiaddr(`/ip6/${ip6}/udp/${udp}`).toString()
|
multiaddr(`/ip6/${ip6}/udp/${udp}`).toString()
|
||||||
);
|
);
|
||||||
|
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||||
|
wsMultiaddr.toString()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,9 +99,8 @@ export class ENR extends RawEnr implements IEnr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const _multiaddrs = this.multiaddrs ?? [];
|
const _multiaddrs = this.multiaddrs ?? [];
|
||||||
multiaddrs.concat(_multiaddrs);
|
|
||||||
|
|
||||||
return multiaddrs;
|
return multiaddrs.concat(_multiaddrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
get peerInfo(): PeerInfo | undefined {
|
get peerInfo(): PeerInfo | undefined {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user