/// Adds the past blocks to the pool, where the heights go from
/// 1 to [CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1]. Returns a
/// copy of the last added block.
Adds the past blocks to the pool, where the heights go from
1 to [CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1]. Returns a
copy of the last added block.
Adds the past blocks to the pool where the heights go from 1 to [ CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1 ] . Returns a copy of the last added block .
fn add_past_blocks(
    consensus_pool: &mut ConsensusPoolImpl,
    now: Time,
    message_count: usize,
) -> Block {
    let cup = consensus_pool
        .validated()
        .catch_up_package()
        .get_by_height(Height::from(0))
        .next()
        .unwrap();
    let mut parent = cup.content.block.into_inner();
    let mut changeset = ChangeSet::new();
    let to_add = CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1;
    for i in 1..=to_add {
        let mut block = Block::from_parent(&parent);
        block.rank = Rank(i as u64);
        let ingress = prepare_ingress_payload(now, message_count, i as u8);
        let xnet = XNetPayload::default();
        let self_validating = SelfValidatingPayload::default();
        block.payload = Payload::new(
            ic_crypto::crypto_hash,
            (
                BatchPayload::new(ingress, xnet, self_validating),
                dkg::Dealings::new_empty(block.payload.as_ref().dkg_interval_start_height()),
                None,
            )
                .into(),
        );
        parent = block.clone();
        let proposal = BlockProposal::fake(block, node_test_id(i as u64));
        changeset.push(ChangeAction::AddToValidated(proposal.into_message()));
    }
    let time_source = FastForwardTimeSource::new();
    consensus_pool.apply_changes(time_source.as_ref(), changeset);
    parent
}
fn add_past_blocks ( consensus_pool : & mut ConsensusPoolImpl , now : Time , message_count : usize , ) -> Block { let cup = consensus_pool . validated ( ) . catch_up_package ( ) . get_by_height ( Height :: from ( 0 ) ) . next ( ) . unwrap ( ) ; let mut parent = cup . content . block . into_inner ( ) ; let mut changeset = ChangeSet :: new ( ) ; let to_add = CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1 ; for i in 1 ..= to_add { let mut block = Block :: from_parent ( & parent ) ; block . rank = Rank ( i as u64 ) ; let ingress = prepare_ingress_payload ( now , message_count , i as u8 ) ; let xnet = XNetPayload :: default ( ) ; let self_validating = SelfValidatingPayload :: default ( ) ; block . payload = Payload :: new ( ic_crypto :: crypto_hash , ( BatchPayload :: new ( ingress , xnet , self_validating ) , dkg :: Dealings :: new_empty ( block . payload . as_ref ( ) . dkg_interval_start_height ( ) ) , None , ) . into ( ) , ) ; parent = block . clone ( ) ; let proposal = BlockProposal :: fake ( block , node_test_id ( i as u64 ) ) ; changeset . push ( ChangeAction :: AddToValidated ( proposal . into_message ( ) ) ) ; } let time_source = FastForwardTimeSource :: new ( ) ; consensus_pool . apply_changes ( time_source . as_ref ( ) , changeset ) ; parent }
Adds the past blocks to the pool, where the heights go from
1 to [CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1].
Adds the past blocks to the pool where the heights go from 1 to [ CERTIFIED_HEIGHT + PAST_PAYLOAD_HEIGHT + 1 ] .
consensus_pool
&mut ConsensusPoolImpl
now
Time
message_count
usize