Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit d158bb1

Browse files
authored
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
1 parent 20864c0 commit d158bb1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

stake-pool/cli/src/main.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,15 +1257,23 @@ fn prepare_withdraw_accounts(
12571257

12581258
(
12591259
transient_stake_account_address,
1260-
validator.transient_stake_lamports,
1260+
validator
1261+
.transient_stake_lamports
1262+
.saturating_sub(min_balance),
12611263
Some(validator.vote_account_address),
12621264
)
12631265
},
12641266
));
12651267

12661268
let reserve_stake = rpc_client.get_account(&stake_pool.reserve_stake)?;
12671269

1268-
accounts.push((stake_pool.reserve_stake, reserve_stake.lamports, None));
1270+
accounts.push((
1271+
stake_pool.reserve_stake,
1272+
reserve_stake.lamports
1273+
- rpc_client.get_minimum_balance_for_rent_exemption(STAKE_STATE_LEN)?
1274+
- 1,
1275+
None,
1276+
));
12691277

12701278
// Prepare the list of accounts to withdraw from
12711279
let mut withdraw_from: Vec<WithdrawAccount> = vec![];

0 commit comments

Comments
 (0)