Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions programs/stake/src/stake_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ impl<'a> StakeAccount for KeyedAccount<'a> {
// verify full withdrawal can cover rent in new split account
|| (lamports < split_rent_exempt_reserve && lamports == self.lamports()?)
// verify enough lamports left in previous stake and not full withdrawal
|| (lamports > self.lamports()? - meta.rent_exempt_reserve
|| (lamports + meta.rent_exempt_reserve > self.lamports()?
&& lamports != self.lamports()?)
{
return Err(InstructionError::InsufficientFunds);
Expand All @@ -929,7 +929,7 @@ impl<'a> StakeAccount for KeyedAccount<'a> {
// account, this prevents any magic activation of stake by prefunding the
// split account.
(
lamports - meta.rent_exempt_reserve,
lamports.saturating_sub(meta.rent_exempt_reserve),
lamports - split_rent_exempt_reserve,
)
} else {
Expand Down