Hi! Suprisingly call to Peerstore.RemovePeer(...)
doesn’t fully remove peer information from Peerstore. And Peerstore.Peers()
keeps returning peer ID that was recently removed.
The reason why it’s happening because one should call RemovePeer()
and ClearAddrs
(method from AddrBook interface). Here is actual implementation of RemovePeer
from *pstoremem
:
// RemovePeer removes entries associated with a peer from:
// * the KeyBook
// * the ProtoBook
// * the PeerMetadata
// * the Metrics
// It DOES NOT remove the peer from the AddrBook.
func (ps *pstoremem) RemovePeer(p peer.ID) {
ps.memoryKeyBook.RemovePeer(p)
ps.memoryProtoBook.RemovePeer(p)
ps.memoryPeerMetadata.RemovePeer(p)
ps.Metrics.RemovePeer(p)
}```
So my question is what was design decision to keep address, but remove the rest of information for a peer?
What are use-cases for it? thanks