lamports += to checked_add (#16841)

This commit is contained in:
Jeff Washington (jwash)
2021-04-27 09:56:18 -05:00
committed by GitHub
parent 47ca7063f2
commit 3887169db0
4 changed files with 18 additions and 8 deletions

View File

@ -686,7 +686,9 @@ pub fn withdraw<S: std::hash::BuildHasher>(
_ => (),
}
vote_account.try_account_ref_mut()?.lamports -= lamports;
to_account.try_account_ref_mut()?.lamports += lamports;
to_account
.try_account_ref_mut()?
.checked_add_lamports(lamports)?;
Ok(())
}