/// Determine if a random tape share should be created for height h
Determine if a random tape share should be created for height h
Determine if a random tape share should be created for height h
fn should_create_share(&self, pool: &PoolReader<'_>, height: Height) -> bool {
        match self.membership.node_belongs_to_threshold_committee(
            self.replica_config.node_id,
            height,
            RandomTape::committee(),
        ) {
            Err(MembershipError::RegistryClientError(_)) => return false,
            Err(MembershipError::NodeNotFound(_)) => panic!(
                "Node {:?} does not belong to subnet {:?}",
                self.replica_config.node_id, self.replica_config.subnet_id
            ),
            Err(MembershipError::UnableToRetrieveDkgSummary(h)) => {
                error!(
                    self.log,
                    "Couldn't find transcript at height {} with finalized height {} and CUP height {}",
                    h,
                    pool.get_finalized_height(),
                    pool.get_catch_up_height()
                );
                return false;
            }
            Ok(false) => {
                // At the given height, this replica is not part of the random beacon committee
                // (which is also responsible for creating the random tape), so we do not have
                // to create a share right now.
                return false;
            }
            Ok(true) => {}
        }
        if pool.get_random_tape(height).is_some() {
            // the random tape for h already exists, so we don't have to create a share
            // anymore
            return false;
        }
        if pool
            .get_random_tape_shares(height, height)
            .any(|s| s.signature.signer == self.replica_config.node_id)
        {
            // I've already created my random tape share for height h, so I don't have to do
            // it again.
            return false;
        }
        // If I am a random tape committee member at height h, I don't have the random
        // tape at height h yet, and I haven't created a share for random tape
        // h, then I should create a share.
        true
    }
fn should_create_share ( & self , pool : & PoolReader < ' _ > , height : Height ) -> bool { match self . membership . node_belongs_to_threshold_committee ( self . replica_config . node_id , height , RandomTape :: committee ( ) , ) { Err ( MembershipError :: RegistryClientError ( _ ) ) => return false , Err ( MembershipError :: NodeNotFound ( _ ) ) => panic ! ( " " self replica_config node_id self replica_config subnet_id ) , Err ( MembershipError :: UnableToRetrieveDkgSummary ( h ) ) => { error ! ( self log " " h pool get_finalized_height ( ) pool get_catch_up_height ( ) ) ; return false ; } Ok ( false ) => { // At the given height, this replica is not part of the random beacon committee // (which is also responsible for creating the random tape), so we do not have // to create a share right now. return false ; } Ok ( true ) => { } } if pool . get_random_tape ( height ) . is_some ( ) { // the random tape for h already exists, so we don't have to create a share // anymore return false ; } if pool . get_random_tape_shares ( height , height ) . any ( | s | s . signature . signer == self . replica_config . node_id ) { // I've already created my random tape share for height h, so I don't have to do // it again. return false ; } // If I am a random tape committee member at height h, I don't have the random // tape at height h yet, and I haven't created a share for random tape // h, then I should create a share. true }
Determine if a random tape share should be created for height h
Determine if a random tape share should be created for height h
&self
pool
&PoolReader<'_>
height
Height