mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 03:51:20 +00:00
23 lines
448 B
Go
23 lines
448 B
Go
|
package peerinfo
|
||
|
|
||
|
import "math/big"
|
||
|
|
||
|
type PeerWithBlockNumInfo struct {
|
||
|
ID string
|
||
|
BlockNum *big.Int
|
||
|
}
|
||
|
|
||
|
type PeersWithBlockNumInfo []*PeerWithBlockNumInfo
|
||
|
|
||
|
func (peers PeersWithBlockNumInfo) Len() int {
|
||
|
return len(peers)
|
||
|
}
|
||
|
|
||
|
func (peers PeersWithBlockNumInfo) Less(i int, j int) bool {
|
||
|
return peers[i].BlockNum.Cmp(peers[j].BlockNum) < 1
|
||
|
}
|
||
|
|
||
|
func (peers PeersWithBlockNumInfo) Swap(i int, j int) {
|
||
|
peers[i], peers[j] = peers[j], peers[i]
|
||
|
}
|