erigon-pulse/polygon/sync/peerinfo/peer_with_block_num_info.go
milen 64072ce6c7
polygon/sync: implement header downloader (#9030)
Co-authored-by: battlmonstr <battlmonstr@users.noreply.github.com>
2023-12-22 10:44:55 +00:00

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