refactor: reuse nim-libp2p peerstore + move peermanager logic (#1383)

* refactor: reuse nim-libp2p peerstore + move peermanager logic

* refactor: fix comments

* refactor: modify reconnectPeers and unittest

* feat(apps): new flag for peerStoreCapacity

* fix(examples): fix example2 target

* refactor: fix comments
This commit is contained in:
Alvaro Revuelta
2022-11-24 14:11:23 +01:00
committed by GitHub
parent 089e2ae1e8
commit 43fd11b4dc
16 changed files with 571 additions and 264 deletions
+2 -2
View File
@@ -101,7 +101,7 @@ proc main(): Future[int] {.async.} =
# ensure input protocols are valid
for p in conf.protocols:
if p notin ProtocolsTable:
if p notin ProtocolsTable:
error "invalid protocol", protocol=p, valid=ProtocolsTable
raise newException(ConfigurationError, "Invalid cli flag values" & p)
@@ -128,7 +128,7 @@ proc main(): Future[int] {.async.} =
error "Timedout after", timeout=conf.timeout
let lp2pPeerStore = node.switch.peerStore
let conStatus = node.peerManager.peerStore.connectionBook[peer.peerId]
let conStatus = node.peerManager.peerStore[ConnectionBook][peer.peerId]
if conStatus in [Connected, CanConnect]:
let nodeProtocols = lp2pPeerStore[ProtoBook][peer.peerId]