pub fn merge_peer_availability(
reports: &BTreeMap<PeerId, PeerAvailability>,
num_peers: NumPeers,
) -> MergedPeerAvailabilityExpand description
Combines the reports of several guardians into one view.
A peer’s own report about itself is ignored. Of the other reports the
NumPeers::one_honest-th lowest value is used, so
NumPeers::max_evil lying guardians cannot push a value below every
honest report. With at least NumPeers::threshold usable reports they
cannot push it above every honest report either. With fewer, for example
while a guardian is offline, they can.
For availability, windows whose window_secs does not match
PEER_AVAILABILITY_WINDOWS_SECS are ignored, and so are reports that
cover less than half of the NumPeers::one_honest-th best coverage.
A peer with fewer than NumPeers::one_honest usable reports is omitted.