@@ -65,7 +65,7 @@ type backgroundRouter struct {
65
65
subscription * pubsub.Subscription
66
66
// kadDHT is a kademlia distributed hash table used for routing and peer discovery.
67
67
kadDHT * dht.IpfsDHT
68
- // TECHDEBT: `pstore` will likely be removed in future refactoring / simplification
68
+ // TECHDEBT(#747, #749) : `pstore` will likely be removed in future refactoring / simplification
69
69
// of the `Router` interface.
70
70
// pstore is the background router's peerstore. Assigned in `backgroundRouter#setupPeerstore()`.
71
71
pstore typesP2P.Peerstore
@@ -250,8 +250,6 @@ func (rtr *backgroundRouter) setupDependencies(ctx context.Context, _ *config.Ba
250
250
}
251
251
252
252
func (rtr * backgroundRouter ) setupPeerstore (ctx context.Context ) (err error ) {
253
- rtr .logger .Warn ().Msg ("setting up peerstore..." )
254
-
255
253
// TECHDEBT(#810, #811): use `bus.GetPeerstoreProvider()` after peerstore provider
256
254
// is retrievable as a proper submodule
257
255
pstoreProviderModule , err := rtr .GetBus ().GetModulesRegistry ().
@@ -276,10 +274,7 @@ func (rtr *backgroundRouter) setupPeerstore(ctx context.Context) (err error) {
276
274
}
277
275
278
276
// TECHDEBT(#859): integrate with `p2pModule#bootstrap()`.
279
- if err := rtr .bootstrap (ctx ); err != nil {
280
- return fmt .Errorf ("bootstrapping peerstore: %w" , err )
281
- }
282
-
277
+ rtr .bootstrap (ctx )
283
278
return nil
284
279
}
285
280
@@ -335,33 +330,36 @@ func (rtr *backgroundRouter) setupSubscription() (err error) {
335
330
}
336
331
337
332
// TECHDEBT(#859): integrate with `p2pModule#bootstrap()`.
338
- func (rtr * backgroundRouter ) bootstrap (ctx context.Context ) error {
333
+ func (rtr * backgroundRouter ) bootstrap (ctx context.Context ) {
339
334
// CONSIDERATION: add `GetPeers` method, which returns a map,
340
335
// to the `PeerstoreProvider` interface to simplify this loop.
341
336
for _ , peer := range rtr .pstore .GetPeerList () {
342
337
if err := utils .AddPeerToLibp2pHost (rtr .host , peer ); err != nil {
343
- return err
338
+ rtr .logger .Error ().Err (err ).Msg ("adding peer to libp2p host" )
339
+ continue
344
340
}
345
341
346
342
libp2pAddrInfo , err := utils .Libp2pAddrInfoFromPeer (peer )
347
343
if err != nil {
348
- return fmt .Errorf (
349
- "converting peer info, pokt address: %s: %w" ,
350
- peer .GetAddress (),
351
- err ,
352
- )
344
+ rtr .logger .Error ().Err (err ).Msg ("converting peer info" )
345
+ continue
353
346
}
354
347
355
348
// don't attempt to connect to self
356
349
if rtr .host .ID () == libp2pAddrInfo .ID {
357
- return nil
350
+ rtr .logger .Debug ().Msg ("not bootstrapping against self" )
351
+ continue
358
352
}
359
353
354
+ rtr .logger .Debug ().Fields (map [string ]any {
355
+ "peer_id" : libp2pAddrInfo .ID .String (),
356
+ "peer_addr" : libp2pAddrInfo .Addrs [0 ].String (),
357
+ }).Msg ("connecting to peer" )
360
358
if err := rtr .host .Connect (ctx , libp2pAddrInfo ); err != nil {
361
- return fmt .Errorf ("connecting to peer: %w" , err )
359
+ rtr .logger .Error ().Err (err ).Msg ("connecting to bootstrap peer" )
360
+ continue
362
361
}
363
362
}
364
- return nil
365
363
}
366
364
367
365
// topicValidator is used in conjunction with libp2p-pubsub's notion of "topic
0 commit comments