chore: saving agent and protoVersion in peerStore

This commit is contained in:
Gabriel mermelstein 2024-06-28 14:12:28 +02:00
parent 9bd8c33aee
commit 9708b97761
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D
2 changed files with 3 additions and 1 deletions

View File

@ -351,7 +351,7 @@ suite "Peer Manager":
await server2.stop()
suite "Tracked Peer Metadata":
xasyncTest "Metadata Recording":
asyncTest "Metadata Recording":
# When adding a peer other than self to the peer store
serverRemotePeerInfo.enr = some(server.enr)
client.peerManager.addPeer(serverRemotePeerInfo)

View File

@ -142,6 +142,8 @@ proc addPeer*(pm: PeerManager, remotePeerInfo: RemotePeerInfo, origin = UnknownO
pm.peerStore[AddressBook][remotePeerInfo.peerId] = remotePeerInfo.addrs
pm.peerStore[KeyBook][remotePeerInfo.peerId] = remotePeerInfo.publicKey
pm.peerStore[SourceBook][remotePeerInfo.peerId] = origin
pm.peerStore[ProtoVersionBook][remotePeerInfo.peerId] = remotePeerInfo.protoVersion
pm.peerStore[AgentBook][remotePeerInfo.peerId] = remotePeerInfo.agent
if remotePeerInfo.protocols.len > 0:
pm.peerStore[ProtoBook][remotePeerInfo.peerId] = remotePeerInfo.protocols