mirror of https://github.com/waku-org/nwaku.git
fix: update peers ENRs in peer store in case they are updated (#2818)
This commit is contained in:
parent
93e9ba22aa
commit
cda18f96ca
|
@ -128,9 +128,16 @@ proc addPeer*(pm: PeerManager, remotePeerInfo: RemotePeerInfo, origin = UnknownO
|
||||||
if pm.peerStore[AddressBook][remotePeerInfo.peerId] == remotePeerInfo.addrs and
|
if pm.peerStore[AddressBook][remotePeerInfo.peerId] == remotePeerInfo.addrs and
|
||||||
pm.peerStore[KeyBook][remotePeerInfo.peerId] == remotePeerInfo.publicKey and
|
pm.peerStore[KeyBook][remotePeerInfo.peerId] == remotePeerInfo.publicKey and
|
||||||
pm.peerStore[ENRBook][remotePeerInfo.peerId].raw.len > 0:
|
pm.peerStore[ENRBook][remotePeerInfo.peerId].raw.len > 0:
|
||||||
trace "peer already managed and ENR info is already saved",
|
let incomingEnr = remotePeerInfo.enr.valueOr:
|
||||||
remote_peer_id = $remotePeerInfo.peerId
|
trace "peer already managed and incoming ENR is empty",
|
||||||
return
|
remote_peer_id = $remotePeerInfo.peerId
|
||||||
|
return
|
||||||
|
|
||||||
|
if pm.peerStore[ENRBook][remotePeerInfo.peerId].raw == incomingEnr.raw or
|
||||||
|
pm.peerStore[ENRBook][remotePeerInfo.peerId].seqNum > incomingEnr.seqNum:
|
||||||
|
trace "peer already managed and ENR info is already saved",
|
||||||
|
remote_peer_id = $remotePeerInfo.peerId
|
||||||
|
return
|
||||||
|
|
||||||
trace "Adding peer to manager",
|
trace "Adding peer to manager",
|
||||||
peerId = remotePeerInfo.peerId, addresses = remotePeerInfo.addrs
|
peerId = remotePeerInfo.peerId, addresses = remotePeerInfo.addrs
|
||||||
|
|
Loading…
Reference in New Issue