erigon-pulse/polygon/sync/peer_with_block_num_info.go

23 lines
444 B
Go

package sync
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]
}