mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-12 21:44:33 +00:00
Missing protocols in identify message are now present
status-im/nim-waku/issues/419 has been fixed.
This commit is contained in:
parent
5733fda0ab
commit
08a7f004c3
@ -1,5 +1,4 @@
|
|||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import Libp2p from 'libp2p';
|
|
||||||
import Pubsub from 'libp2p-interfaces/src/pubsub';
|
import Pubsub from 'libp2p-interfaces/src/pubsub';
|
||||||
|
|
||||||
import { NimWaku } from '../test_utils/nim_waku';
|
import { NimWaku } from '../test_utils/nim_waku';
|
||||||
@ -99,8 +98,6 @@ describe('Waku Relay', () => {
|
|||||||
// https://github.com/status-im/nim-waku/issues/422 is fixed
|
// https://github.com/status-im/nim-waku/issues/422 is fixed
|
||||||
waku.libp2p.pubsub.globalSignaturePolicy = 'StrictSign';
|
waku.libp2p.pubsub.globalSignaturePolicy = 'StrictSign';
|
||||||
|
|
||||||
await patchPeerStore(nimWaku, waku.libp2p);
|
|
||||||
|
|
||||||
await waku.relay.publish(message);
|
await waku.relay.publish(message);
|
||||||
|
|
||||||
await nimWaku.waitForLog('WakuMessage received');
|
await nimWaku.waitForLog('WakuMessage received');
|
||||||
@ -118,8 +115,6 @@ describe('Waku Relay', () => {
|
|||||||
this.timeout(5000);
|
this.timeout(5000);
|
||||||
const message = Message.fromUtf8String('Here is another message.');
|
const message = Message.fromUtf8String('Here is another message.');
|
||||||
|
|
||||||
await patchPeerStore(nimWaku, waku.libp2p);
|
|
||||||
|
|
||||||
await waku.relay.subscribe();
|
await waku.relay.subscribe();
|
||||||
|
|
||||||
await new Promise((resolve) =>
|
await new Promise((resolve) =>
|
||||||
@ -148,19 +143,3 @@ function waitForNextData(pubsub: Pubsub): Promise<Message> {
|
|||||||
return Message.fromBinary(msg.data);
|
return Message.fromBinary(msg.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove this hack, tracked with https://github.com/status-im/nim-waku/issues/419
|
|
||||||
async function patchPeerStore(nimWaku: NimWaku, node: Libp2p) {
|
|
||||||
const nimPeerId = await nimWaku.getPeerId();
|
|
||||||
node.identifyService!.peerStore.protoBook.set(nimPeerId, [CODEC]);
|
|
||||||
const peer = node.peerStore.peers.get(nimPeerId.toB58String());
|
|
||||||
if (!peer) {
|
|
||||||
throw 'Did not find nim-waku node in peers';
|
|
||||||
}
|
|
||||||
peer.protocols = [CODEC];
|
|
||||||
node.peerStore.peers.set(nimPeerId.toB58String(), peer);
|
|
||||||
|
|
||||||
await new Promise((resolve) =>
|
|
||||||
node.pubsub.once('gossipsub:heartbeat', resolve)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user