From 444b84d181208d223fbf3a59389a844dea805478 Mon Sep 17 00:00:00 2001 From: vyzo Date: Sat, 6 Mar 2021 19:25:11 +0200 Subject: [PATCH] deduplicate peers in extended output --- cli/net.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli/net.go b/cli/net.go index 011704243..44e83b387 100644 --- a/cli/net.go +++ b/cli/net.go @@ -71,7 +71,16 @@ var NetPeers = &cli.Command{ }) if cctx.Bool("extended") { + // deduplicate + seen := make(map[peer.ID]struct{}) + for _, peer := range peers { + _, dup := seen[peer.ID] + if dup { + continue + } + seen[peer.ID] = struct{}{} + info, err := api.NetPeerInfo(ctx, peer.ID) if err != nil { log.Warnf("error getting extended peer info: %s", err)