File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 161
161
"generate:proto-types" : " pbts -o src/message/message.d.ts src/message/message.js"
162
162
},
163
163
"dependencies" : {
164
- "@libp2p/interfaces" : " ^1.3.18 " ,
164
+ "@libp2p/interfaces" : " ^2.0.2 " ,
165
165
"@libp2p/topology" : " ^1.1.6" ,
166
166
"@libp2p/tracked-map" : " ^1.0.4" ,
167
167
"@multiformats/multiaddr" : " ^10.1.8" ,
182
182
"varint-decoder" : " ^1.0.0"
183
183
},
184
184
"devDependencies" : {
185
- "@chainsafe/libp2p-noise" : " ^6.0.1 " ,
185
+ "@chainsafe/libp2p-noise" : " ^6.2.0 " ,
186
186
"@libp2p/kad-dht" : " ^1.0.3" ,
187
187
"@libp2p/mplex" : " ^1.0.2" ,
188
188
"@libp2p/peer-id" : " ^1.1.8" ,
214
214
"process" : " ^0.11.10" ,
215
215
"promisify-es6" : " ^1.0.3" ,
216
216
"rimraf" : " ^3.0.2" ,
217
- "sinon" : " ^13 .0.1 " ,
217
+ "sinon" : " ^14 .0.0 " ,
218
218
"stats-lite" : " ^2.2.0" ,
219
219
"url" : " ^0.11.0" ,
220
220
"util" : " ^0.12.3" ,
Original file line number Diff line number Diff line change @@ -31,8 +31,7 @@ export const mockLibp2pNode = () => {
31
31
const buf = uint8ArrayFromString ( '122019318b6e5e0cf93a2314bf01269a2cc23cd3dcd452d742cdb9379d8646f6e4a9' , 'base16' )
32
32
const peerId = peerIdFromBytes ( buf )
33
33
34
- // @ts -ignore - not all libp2p fields are implemented
35
- return Object . assign ( new EventEmitter ( ) , {
34
+ const libp2p = Object . assign ( new EventEmitter ( ) , {
36
35
peerId,
37
36
multiaddrs : [ ] ,
38
37
handle ( ) { } ,
@@ -57,10 +56,15 @@ export const mockLibp2pNode = () => {
57
56
swarm : {
58
57
setMaxListeners ( ) { }
59
58
} ,
60
- peerStore : new PersistentPeerStore ( new Components ( { peerId , datastore : new MemoryDatastore ( ) } ) , {
59
+ peerStore : new PersistentPeerStore ( {
61
60
addressFilter : async ( ) => true
62
61
} )
63
62
} )
63
+
64
+ libp2p . peerStore . init ( new Components ( { peerId, datastore : new MemoryDatastore ( ) } ) )
65
+
66
+ // @ts -expect-error not all libp2p fields are implemented
67
+ return libp2p
64
68
}
65
69
66
70
/**
@@ -173,7 +177,10 @@ export const genBitswapNetwork = async (n, enableDHT = false) => {
173
177
peers . map ( async ( peerId , i ) => {
174
178
const libp2p = await createLibp2pNode ( {
175
179
peerId,
176
- DHT : enableDHT
180
+ DHT : enableDHT ,
181
+ nat : {
182
+ enabled : false
183
+ }
177
184
} )
178
185
179
186
await libp2p . start ( )
You can’t perform that action at this time.
0 commit comments