stake_pool: fix wrong available_for_withdrawal_wo_fee calculation (#2900)
* - fix wrong available_for_withdrawal_wo_fee calculation by prepare_withdraw_accounts * - fix formatting * - refactor * - fix sub issue
This commit is contained in:
parent
20864c0be7
commit
d158bb150c
|
@ -1257,7 +1257,9 @@ fn prepare_withdraw_accounts(
|
|||
|
||||
(
|
||||
transient_stake_account_address,
|
||||
validator.transient_stake_lamports,
|
||||
validator
|
||||
.transient_stake_lamports
|
||||
.saturating_sub(min_balance),
|
||||
Some(validator.vote_account_address),
|
||||
)
|
||||
},
|
||||
|
@ -1265,7 +1267,13 @@ fn prepare_withdraw_accounts(
|
|||
|
||||
let reserve_stake = rpc_client.get_account(&stake_pool.reserve_stake)?;
|
||||
|
||||
accounts.push((stake_pool.reserve_stake, reserve_stake.lamports, None));
|
||||
accounts.push((
|
||||
stake_pool.reserve_stake,
|
||||
reserve_stake.lamports
|
||||
- rpc_client.get_minimum_balance_for_rent_exemption(STAKE_STATE_LEN)?
|
||||
- 1,
|
||||
None,
|
||||
));
|
||||
|
||||
// Prepare the list of accounts to withdraw from
|
||||
let mut withdraw_from: Vec<WithdrawAccount> = vec![];
|
||||
|
|
Loading…
Reference in New Issue