mirror of https://github.com/waku-org/js-waku.git
pubsub config is specific to waku relay
This commit is contained in:
parent
eb06f056c0
commit
33a6176181
|
@ -18,18 +18,6 @@ export async function createNode() {
|
||||||
// @ts-ignore: Type needs update
|
// @ts-ignore: Type needs update
|
||||||
pubsub: WakuRelayPubsub,
|
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();
|
await node.start();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Gossipsub from 'libp2p-gossipsub';
|
import Gossipsub from 'libp2p-gossipsub';
|
||||||
import { Libp2p } from 'libp2p-gossipsub/src/interfaces';
|
import { Libp2p } from 'libp2p-gossipsub/src/interfaces';
|
||||||
import Pubsub from 'libp2p-interfaces/src/pubsub';
|
import Pubsub from 'libp2p-interfaces/src/pubsub';
|
||||||
|
import { SignaturePolicy } from 'libp2p-interfaces/src/pubsub/signature-policy';
|
||||||
|
|
||||||
import { Message } from './waku_message';
|
import { Message } from './waku_message';
|
||||||
|
|
||||||
|
@ -16,13 +17,17 @@ export class WakuRelayPubsub extends Gossipsub {
|
||||||
* @param libp2p: Libp2p
|
* @param libp2p: Libp2p
|
||||||
* @param options: Partial<GossipInputOptions>
|
* @param options: Partial<GossipInputOptions>
|
||||||
*/
|
*/
|
||||||
constructor(libp2p: Libp2p, options?: any) {
|
constructor(libp2p: Libp2p) {
|
||||||
super(libp2p, options);
|
super(libp2p, {
|
||||||
|
emitSelf: true,
|
||||||
|
// Ensure that no signature is expected in the messages.
|
||||||
|
globalSignaturePolicy: SignaturePolicy.StrictNoSign,
|
||||||
|
});
|
||||||
|
|
||||||
const multicodecs = [CODEC];
|
const multicodecs = [CODEC];
|
||||||
|
|
||||||
// This is the downside of using `libp2p-gossipsub` instead of
|
// This is the downside of using `libp2p-gossipsub` instead of
|
||||||
// implementing WakuRelay from scratch.C
|
// implementing WakuRelay from scratch.
|
||||||
Object.assign(this, { multicodecs });
|
Object.assign(this, { multicodecs });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue