erigon-pulse/gointerfaces/remote/sort.go
Dmitry Savelev da3c239ed6
Add nodeInfo GRPC methods (#196)
* Add nodeInfo

* Remove interfaces for replacement

Signed-off-by: Dmitry Savelev <darksawa@gmail.com>

* Squashed 'interfaces/' content from commit 67abfdd

git-subtree-dir: interfaces
git-subtree-split: 67abfdd23b3bbef0d2f0c038275b6f47820d7f5e
2021-11-30 14:41:31 +00:00

21 lines
440 B
Go

package remote
import (
"strings"
)
func (x *NodesInfoReply) Len() int {
return len(x.NodesInfo)
}
func (x *NodesInfoReply) Less(i, j int) bool {
if cmp := strings.Compare(x.NodesInfo[i].Name, x.NodesInfo[j].Name); cmp != 0 {
return cmp == -1
}
return strings.Compare(x.NodesInfo[i].Enode, x.NodesInfo[j].Enode) == -1
}
func (x *NodesInfoReply) Swap(i, j int) {
x.NodesInfo[i], x.NodesInfo[j] = x.NodesInfo[j], x.NodesInfo[i]
}