pub fn update_stake_pool(
    program_id: &Pubkey,
    stake_pool: &StakePool,
    validator_list: &ValidatorList,
    stake_pool_address: &Pubkey,
    no_merge: bool,
) -> Vec<Instruction> {
    let vote_accounts: Vec<Pubkey> = validator_list
        .validators
        .iter()
        .map(|item| item.vote_account_address)
        .collect();

    let (withdraw_authority, _) =
        find_withdraw_authority_program_address(program_id, stake_pool_address);

    let mut instructions: Vec<Instruction> = vec![];
    let mut start_index = 0;
    for accounts_chunk in vote_accounts.chunks(MAX_VALIDATORS_TO_UPDATE) {
        instructions.push(update_validator_list_balance(
            program_id,
            stake_pool_address,
            &withdraw_authority,
            &stake_pool.validator_list,
            &stake_pool.reserve_stake,
            &accounts_chunk,
            start_index,
            no_merge,
        ));
        start_index += MAX_VALIDATORS_TO_UPDATE as u32;
    }

    instructions.push(update_stake_pool_balance(
        program_id,
        stake_pool_address,
        &withdraw_authority,
        &stake_pool.validator_list,
        &stake_pool.reserve_stake,
        &stake_pool.manager_fee_account,
        &stake_pool.pool_mint,
    ));
    instructions
}
/// Creates all `UpdateValidatorListBalance` and `UpdateStakePoolBalance`
/// instructions for fully updating a stake pool each epoch
Creates all `UpdateValidatorListBalance` and `UpdateStakePoolBalance`
instructions for fully updating a stake pool each epoch
Creates all ` UpdateValidatorListBalance ` and ` UpdateStakePoolBalance ` instructions for fully updating a stake pool each epoch
pub fn update_stake_pool(
    program_id: &Pubkey,
    stake_pool: &StakePool,
    validator_list: &ValidatorList,
    stake_pool_address: &Pubkey,
    no_merge: bool,
) -> Vec<Instruction> {
    let vote_accounts: Vec<Pubkey> = validator_list
        .validators
        .iter()
        .map(|item| item.vote_account_address)
        .collect();
    let (withdraw_authority, _) =
        find_withdraw_authority_program_address(program_id, stake_pool_address);
    let mut instructions: Vec<Instruction> = vec![];
    let mut start_index = 0;
    for accounts_chunk in vote_accounts.chunks(MAX_VALIDATORS_TO_UPDATE) {
        instructions.push(update_validator_list_balance(
            program_id,
            stake_pool_address,
            &withdraw_authority,
            &stake_pool.validator_list,
            &stake_pool.reserve_stake,
            &accounts_chunk,
            start_index,
            no_merge,
        ));
        start_index += MAX_VALIDATORS_TO_UPDATE as u32;
    }
    instructions.push(update_stake_pool_balance(
        program_id,
        stake_pool_address,
        &withdraw_authority,
        &stake_pool.validator_list,
        &stake_pool.reserve_stake,
        &stake_pool.manager_fee_account,
        &stake_pool.pool_mint,
    ));
    instructions
}
pub fn update_stake_pool ( program_id : & Pubkey , stake_pool : & StakePool , validator_list : & ValidatorList , stake_pool_address : & Pubkey , no_merge : bool , ) -> Vec < Instruction > { let vote_accounts : Vec < Pubkey > = validator_list . validators . iter ( ) . map ( | item | item . vote_account_address ) . collect ( ) ; let ( withdraw_authority , _ ) = find_withdraw_authority_program_address ( program_id , stake_pool_address ) ; let mut instructions : Vec < Instruction > = vec ! [ ] ; let mut start_index = 0 ; for accounts_chunk in vote_accounts . chunks ( MAX_VALIDATORS_TO_UPDATE ) { instructions . push ( update_validator_list_balance ( program_id , stake_pool_address , & withdraw_authority , & stake_pool . validator_list , & stake_pool . reserve_stake , & accounts_chunk , start_index , no_merge , ) ) ; start_index += MAX_VALIDATORS_TO_UPDATE as u32 ; } instructions . push ( update_stake_pool_balance ( program_id , stake_pool_address , & withdraw_authority , & stake_pool . validator_list , & stake_pool . reserve_stake , & stake_pool . manager_fee_account , & stake_pool . pool_mint , ) ) ; instructions }
Creates all `UpdateValidatorListBalance` and `UpdateStakePoolBalance`
instructions for fully updating a stake pool each epoch
Creates all ` UpdateValidatorListBalance ` and ` UpdateStakePoolBalance ` instructions for fully updating a stake pool each epoch
program_id
&Pubkey
stake_pool
&StakePool
validator_list
&ValidatorList
stake_pool_address
&Pubkey
no_merge
bool
program_id
&Pubkey
stake_pool
&StakePool
validator_list
&ValidatorList
stake_pool_address
&Pubkey
no_merge
bool