This commit is contained in:
Sasha 2025-04-18 16:33:07 +02:00
parent a7e96385c2
commit 1d9010f059
No known key found for this signature in database
3 changed files with 24 additions and 21 deletions

View File

@ -351,9 +351,9 @@
"license": "MIT"
},
"node_modules/@libp2p/bootstrap": {
"version": "11.0.34",
"resolved": "https://registry.npmjs.org/@libp2p/bootstrap/-/bootstrap-11.0.34.tgz",
"integrity": "sha512-H5c0bGvw2Luz/wubeIbHDbptm6dAR+73juZOGHOiGbJSiSBuF+kMVPWJWkTzQv5yADIt6g+sbA1i9wyAalEwCA==",
"version": "11.0.35",
"resolved": "https://registry.npmjs.org/@libp2p/bootstrap/-/bootstrap-11.0.35.tgz",
"integrity": "sha512-fv9PNsWTrsGQmRqMv31scB2F/wr2NXgwrTUvtxaxZPJBLN2YVa3HksUP5vh/A8gRedrFsWcpXFGcwY4rO3W8FA==",
"license": "Apache-2.0 OR MIT",
"dependencies": {
"@libp2p/interface": "^2.9.0",
@ -440,9 +440,9 @@
}
},
"node_modules/@libp2p/mplex": {
"version": "11.0.34",
"resolved": "https://registry.npmjs.org/@libp2p/mplex/-/mplex-11.0.34.tgz",
"integrity": "sha512-88A/gIKnp/QtnrddPGcWL3rQZqWuPdZ+wjGz2TQZIFsFhDDhpDhgIZw0VtDAGpCwRC1aEwXa4OmDYzabahA82A==",
"version": "11.0.35",
"resolved": "https://registry.npmjs.org/@libp2p/mplex/-/mplex-11.0.35.tgz",
"integrity": "sha512-aOG/uBiAE1eRwhtZlow1LvxSREbQW9LBTGzUVtVYHBPVl+tNv/hzjAEssVEMnA8y2ckMDM3G+sCpoCAsaYzNow==",
"license": "Apache-2.0 OR MIT",
"dependencies": {
"@libp2p/interface": "^2.9.0",
@ -3371,9 +3371,9 @@
"license": "MIT"
},
"node_modules/electron-to-chromium": {
"version": "1.5.137",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.137.tgz",
"integrity": "sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA==",
"version": "1.5.138",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.138.tgz",
"integrity": "sha512-FWlQc52z1dXqm+9cCJ2uyFgJkESd+16j6dBEjsgDNuHjBpuIzL8/lRc0uvh1k8RNI6waGo6tcy2DvwkTBJOLDg==",
"dev": true,
"license": "ISC"
},
@ -6192,9 +6192,9 @@
}
},
"node_modules/libp2p": {
"version": "2.8.4",
"resolved": "https://registry.npmjs.org/libp2p/-/libp2p-2.8.4.tgz",
"integrity": "sha512-NGsbZ8MQFpuiZKP57hn8qe4QZ7r1j6LTlGx4m3FAVurPtyWHpZ702sWrqpFJveXAYl17Lk7OOA0r08T0k0SS2g==",
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/libp2p/-/libp2p-2.8.5.tgz",
"integrity": "sha512-K2jqFmNp3LsTeuJ15t6jG0Z9WoydLs+AfSDvhSYQa7lRTu9IANt84SxNg+PsmGxMMiTOtIoMmo27DHzF3+ON8Q==",
"license": "Apache-2.0 OR MIT",
"dependencies": {
"@chainsafe/is-ip": "^2.0.2",
@ -6285,9 +6285,9 @@
"license": "MIT"
},
"node_modules/long": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/long/-/long-5.3.1.tgz",
"integrity": "sha512-ka87Jz3gcx/I7Hal94xaN2tZEOPoUOEVftkQqZx2EeQRN7LGdfLlI3FvZ+7WDplm+vK2Urx9ULrvSowtdCieng==",
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
"integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
"license": "Apache-2.0"
},
"node_modules/loose-envify": {
@ -8964,9 +8964,9 @@
}
},
"node_modules/webpack": {
"version": "5.99.5",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.99.5.tgz",
"integrity": "sha512-q+vHBa6H9qwBLUlHL4Y7L0L1/LlyBKZtS9FHNCQmtayxjI5RKC9yD8gpvLeqGv5lCQp1Re04yi0MF40pf30Pvg==",
"version": "5.99.6",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.99.6.tgz",
"integrity": "sha512-TJOLrJ6oeccsGWPl7ujCYuc0pIq2cNsuD6GZDma8i5o5Npvcco/z+NKvZSFsP0/x6SShVb0+X2JK/JHUjKY9dQ==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@ -47,8 +47,12 @@ async function wakuNode(): Promise<LightNode> {
const privateKey = await generateKeyPairFromSeed("Ed25519", fromString(seed));
const node = await createLightNode({
defaultBootstrap: true,
defaultBootstrap: false,
numPeersToUse: 2,
networkConfig: {
clusterId: 42,
shards: [0]
},
libp2p: {
privateKey,
},

View File

@ -1,4 +1,3 @@
import { Peer } from "@libp2p/interface";
import type { LightNode } from "@waku/sdk";
export const generateRandomNumber = (): number => {
@ -19,7 +18,7 @@ export const DEFAULT_EXTRA_DATA_STR = JSON.stringify(DEFAULT_EXTRA_DATA);
export const buildExtraData = async (node: LightNode, peerId: string): Promise<string> => {
let extraData = { ...DEFAULT_EXTRA_DATA };
const peer: Peer = (await node.libp2p.peerStore.all()).find(p => p.id.toString() === peerId);
const peer = (await node.libp2p.peerStore.all()).find(p => p.id.toString() === peerId);
if (!peer || peerId === node.libp2p.peerId.toString()) {
return JSON.stringify(extraData);