Skip to content

Commit

Permalink
stake-pool: Initialize all pool fields explicitly (solana-labs#2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque authored Oct 18, 2021
1 parent 50b5597 commit f97c61a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions stake-pool/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,17 @@ impl Processor {
stake_pool.account_type = AccountType::StakePool;
stake_pool.manager = *manager_info.key;
stake_pool.staker = *staker_info.key;
stake_pool.reserve_stake = *reserve_stake_info.key;
stake_pool.stake_deposit_authority = stake_deposit_authority;
stake_pool.stake_withdraw_bump_seed = stake_withdraw_bump_seed;
stake_pool.validator_list = *validator_list_info.key;
stake_pool.reserve_stake = *reserve_stake_info.key;
stake_pool.pool_mint = *pool_mint_info.key;
stake_pool.manager_fee_account = *manager_fee_info.key;
stake_pool.token_program_id = *token_program_info.key;
stake_pool.last_update_epoch = Clock::get()?.epoch;
stake_pool.total_lamports = total_lamports;
stake_pool.pool_token_supply = 0;
stake_pool.last_update_epoch = Clock::get()?.epoch;
stake_pool.lockup = stake_program::Lockup::default();
stake_pool.epoch_fee = epoch_fee;
stake_pool.next_epoch_fee = None;
stake_pool.preferred_deposit_validator_vote_address = None;
Expand All @@ -666,7 +668,9 @@ impl Processor {
stake_pool.sol_referral_fee = referral_fee;
stake_pool.sol_withdraw_authority = None;
stake_pool.sol_withdrawal_fee = withdrawal_fee;
stake_pool.next_stake_withdrawal_fee = None;
stake_pool.next_sol_withdrawal_fee = None;
stake_pool.last_epoch_pool_token_supply = 0;
stake_pool.last_epoch_total_lamports = 0;

stake_pool
.serialize(&mut *stake_pool_info.data.borrow_mut())
Expand Down

0 comments on commit f97c61a

Please sign in to comment.