Skip to content

Commit

Permalink
Add a filter for nodes to exclude a host node (#2149)
Browse files Browse the repository at this point in the history
* Add a filter for nodes to exclude a host node

* Update p2p/p2p.go

Co-authored-by: Ng Wei Han <[email protected]>
Signed-off-by: Daniil Ankushin <[email protected]>

---------

Signed-off-by: Daniil Ankushin <[email protected]>
Co-authored-by: Ng Wei Han <[email protected]>
  • Loading branch information
AnkushinDaniil and weiihann authored Sep 16, 2024
1 parent 175cff2 commit 6735ed5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ func (s *Service) persistPeers() error {
}

store := s.host.Peerstore()
peers := store.Peers()
peers := utils.Filter(store.Peers(), func(peerID peer.ID) bool {
return peerID != s.host.ID()
})
for _, peerID := range peers {
peerInfo := store.PeerInfo(peerID)

Expand Down

0 comments on commit 6735ed5

Please sign in to comment.