chore: dial provided now

This commit is contained in:
Danish Arora 2024-10-24 19:32:55 +05:30
parent c01da40e19
commit 728b3c5f2d
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E

View File

@ -108,6 +108,15 @@ export class WakuNode implements IWaku {
if (protocolsEnabled.store) {
const store = wakuStore(this.connectionManager);
this.store = store(libp2p);
if (options.nodesToUse?.store) {
this.dialMultiaddr(
options.nodesToUse.store[0],
this.store.protocol.multicodec
).catch((e) => {
log.error("Failed to dial store peer", e);
});
}
}
if (protocolsEnabled.lightpush) {
@ -224,6 +233,14 @@ export class WakuNode implements IWaku {
return this.connectionManager.isConnected();
}
private async dialMultiaddr(
multiaddrStr: string,
protocol: string
): Promise<void> {
const ma = multiaddr(multiaddrStr);
await this.libp2p.dialProtocol(ma, [protocol]);
}
private mapToPeerIdOrMultiaddr(
peerId: PeerId | MultiaddrInput
): PeerId | Multiaddr {