Remove overflow opportunities (#13649)

This commit is contained in:
Tyera Eulberg 2020-11-17 12:01:11 -07:00 committed by GitHub
parent df1f53950e
commit a7bed62af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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);
@ -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 {