deduplicate peers in extended output

This commit is contained in:
vyzo 2021-03-06 19:25:11 +02:00
parent 4a74f752c0
commit 444b84d181

View File

@ -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)