mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-07-30 21:43:10 +00:00
Store bootstrapNodes to reuse them when during the start
This commit is contained in:
parent
d1a44ef997
commit
5b37ee9210
@ -64,6 +64,7 @@ type
|
||||
natRouter*: Option[NatRouter]
|
||||
holePunchHandler: Option[connmanager.PeerEventHandler]
|
||||
peerInfoObserver: Option[PeerInfoObserver]
|
||||
bootstrapNodes: seq[SignedPeerRecord]
|
||||
isStarted: bool
|
||||
|
||||
StoragePrivateKey* = libp2p.PrivateKey # alias
|
||||
@ -126,13 +127,7 @@ proc start*(s: StorageServer) {.async.} =
|
||||
|
||||
# Connect to the bootstrap nodes in order to have connected peers
|
||||
# for Autonat.
|
||||
let bootstrapNodes =
|
||||
if s.config.bootstrapNodes.len > 0:
|
||||
s.config.bootstrapNodes
|
||||
else:
|
||||
s.config.network.bootstrapNodes
|
||||
|
||||
for spr in findReachableNodes(bootstrapNodes):
|
||||
for spr in findReachableNodes(s.bootstrapNodes):
|
||||
try:
|
||||
let addrs = spr.data.addresses.mapIt(it.address)
|
||||
await s.storageNode.switch.connect(spr.data.peerId, addrs)
|
||||
@ -538,4 +533,5 @@ proc new*(
|
||||
natRouter: natRouter,
|
||||
holePunchHandler: holePunchHandler,
|
||||
peerInfoObserver: peerInfoObserver,
|
||||
bootstrapNodes: bootstrapNodes,
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user