/// Check the validity of a collection of RandomBeacon(/Share)s against the
/// random beacon tip. This consists of checking whether each beacon:
/// * points to this parent,
/// * is signed by member(s) of the threshold group,
/// * has a valid signature.
Check the validity of a collection of RandomBeacon(/Share)s against the
random beacon tip. This consists of checking whether each beacon:
points to this parent,
is signed by member(s) of the threshold group,
has a valid signature.
Check the validity of a collection of RandomBeacon ( / Share ) s against the random beacon tip . This consists of checking whether each beacon : points to this parent is signed by member ( s ) of the threshold group has a valid signature .
fn validate_beacon_artifacts<S>(
        &self,
        pool_reader: &PoolReader<'_>,
        beacons: Box<dyn Iterator<Item = Signed<RandomBeaconContent, S>>>,
    ) -> ChangeSet
    where
        Signed<RandomBeaconContent, S>: SignatureVerify + ConsensusMessageHashable + Clone,
    {
        let last_beacon = pool_reader.get_random_beacon_tip();
        let last_hash: CryptoHashOf<RandomBeacon> = ic_crypto::crypto_hash(&last_beacon);
        let last_height = last_beacon.content.height();
        beacons
            .filter_map(|beacon| {
                // This function expects to handle only the following height.
                debug_assert_eq!(beacon.content.height, last_height.increment());
                if last_hash != beacon.content.parent {
                    Some(ChangeAction::HandleInvalid(
                        beacon.into_message(),
                        "The parent hash of the beacon was not correct".to_string(),
                    ))
                } else {
                    let verification = self.verify_signature(pool_reader, &beacon);
                    self.compute_action_from_sig_verification(verification, beacon.into_message())
                }
            })
            .collect()
    }
fn validate_beacon_artifacts < S > ( & self , pool_reader : & PoolReader < ' _ > , beacons : Box < dyn Iterator < Item = Signed < RandomBeaconContent , S > > > , ) -> ChangeSet where Signed < RandomBeaconContent , S > : SignatureVerify + ConsensusMessageHashable + Clone , { let last_beacon = pool_reader . get_random_beacon_tip ( ) ; let last_hash : CryptoHashOf < RandomBeacon > = ic_crypto :: crypto_hash ( & last_beacon ) ; let last_height = last_beacon . content . height ( ) ; beacons . filter_map ( | beacon | { // This function expects to handle only the following height. debug_assert_eq ! ( beacon content height last_height increment ( ) ) ; if last_hash != beacon . content . parent { Some ( ChangeAction :: HandleInvalid ( beacon . into_message ( ) , " " . to_string ( ) , ) ) } else { let verification = self . verify_signature ( pool_reader , & beacon ) ; self . compute_action_from_sig_verification ( verification , beacon . into_message ( ) ) } } ) . collect ( ) }
Check the validity of a collection of RandomBeacon(/Share)s against the
random beacon tip.
Check the validity of a collection of RandomBeacon ( / Share ) s against the random beacon tip .
&self
pool_reader
&PoolReader<'_>
beacons
Box<dyn Iterator<Item = Signed<RandomBeaconContent, S>>>