pubsub config is specific to waku relay

This commit is contained in:
Franck Royer 2021-03-17 14:30:35 +11:00
parent eb06f056c0
commit 33a6176181
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 8 additions and 15 deletions

View File

@ -18,18 +18,6 @@ export async function createNode() {
// @ts-ignore: Type needs update
pubsub: WakuRelayPubsub,
},
config: {
pubsub: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
enabled: true,
emitSelf: true,
signMessages: false,
strictSigning: false,
// Ensure that no signature is expected in the messages.
globalSignaturePolicy: 'StrictNoSign',
},
},
});
await node.start();

View File

@ -1,6 +1,7 @@
import Gossipsub from 'libp2p-gossipsub';
import { Libp2p } from 'libp2p-gossipsub/src/interfaces';
import Pubsub from 'libp2p-interfaces/src/pubsub';
import { SignaturePolicy } from 'libp2p-interfaces/src/pubsub/signature-policy';
import { Message } from './waku_message';
@ -16,13 +17,17 @@ export class WakuRelayPubsub extends Gossipsub {
* @param libp2p: Libp2p
* @param options: Partial<GossipInputOptions>
*/
constructor(libp2p: Libp2p, options?: any) {
super(libp2p, options);
constructor(libp2p: Libp2p) {
super(libp2p, {
emitSelf: true,
// Ensure that no signature is expected in the messages.
globalSignaturePolicy: SignaturePolicy.StrictNoSign,
});
const multicodecs = [CODEC];
// This is the downside of using `libp2p-gossipsub` instead of
// implementing WakuRelay from scratch.C
// implementing WakuRelay from scratch.
Object.assign(this, { multicodecs });
}
}