Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
package p2p

import (
"cmp"
"crypto/ecdsa"
"errors"
"net"
"slices"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -1046,12 +1048,9 @@ func (srv *Server) PeersInfo() []*PeerInfo {
}
}
// Sort the result array alphabetically by node identifier
for i := 0; i < len(infos); i++ {
for j := i + 1; j < len(infos); j++ {
if infos[i].ID > infos[j].ID {
infos[i], infos[j] = infos[j], infos[i]
}
}
}
slices.SortFunc(infos, func(a, b *PeerInfo) int {
return cmp.Compare(a.ID, b.ID)
})

return infos
}