deduplicate peers in extended output
This commit is contained in:
parent
4a74f752c0
commit
444b84d181
@ -71,7 +71,16 @@ var NetPeers = &cli.Command{
|
|||||||
})
|
})
|
||||||
|
|
||||||
if cctx.Bool("extended") {
|
if cctx.Bool("extended") {
|
||||||
|
// deduplicate
|
||||||
|
seen := make(map[peer.ID]struct{})
|
||||||
|
|
||||||
for _, peer := range peers {
|
for _, peer := range peers {
|
||||||
|
_, dup := seen[peer.ID]
|
||||||
|
if dup {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
seen[peer.ID] = struct{}{}
|
||||||
|
|
||||||
info, err := api.NetPeerInfo(ctx, peer.ID)
|
info, err := api.NetPeerInfo(ctx, peer.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("error getting extended peer info: %s", err)
|
log.Warnf("error getting extended peer info: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user