mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-11 13:04:41 +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 tcp = 8080;
|
||||
const udp = 8080;
|
||||
const wsMultiaddr = multiaddr(
|
||||
"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/8000/wss"
|
||||
);
|
||||
let peerId: PeerId;
|
||||
let enr: ENR;
|
||||
|
||||
@ -323,6 +326,7 @@ describe("ENR", function () {
|
||||
enr.udp = udp;
|
||||
enr.tcp6 = tcp;
|
||||
enr.udp6 = udp;
|
||||
enr.multiaddrs = [wsMultiaddr];
|
||||
});
|
||||
|
||||
it("should properly create location multiaddrs - udp4", () => {
|
||||
@ -391,7 +395,7 @@ describe("ENR", function () {
|
||||
const peerInfo = enr.peerInfo!;
|
||||
console.log(peerInfo);
|
||||
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(
|
||||
multiaddr(`/ip4/${ip4}/tcp/${tcp}`).toString()
|
||||
);
|
||||
@ -404,6 +408,9 @@ describe("ENR", function () {
|
||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||
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 ?? [];
|
||||
multiaddrs.concat(_multiaddrs);
|
||||
|
||||
return multiaddrs;
|
||||
return multiaddrs.concat(_multiaddrs);
|
||||
}
|
||||
|
||||
get peerInfo(): PeerInfo | undefined {
|
||||
|
Loading…
x
Reference in New Issue
Block a user