lamports -> lamports() (#16920)

This commit is contained in:
Jeff Washington (jwash)
2021-04-29 10:44:46 -05:00
committed by GitHub
parent 59e19828ea
commit ca7b36ad8f
7 changed files with 42 additions and 38 deletions

View File

@ -125,13 +125,13 @@ impl PreAccount {
// An account not assigned to the program cannot have its balance decrease.
if program_id != pre.owner() // line coverage used to get branch coverage
&& pre.lamports() > post.lamports
&& pre.lamports() > post.lamports()
{
return Err(InstructionError::ExternalAccountLamportSpend);
}
// The balance of read-only and executable accounts may not change
let lamports_changed = pre.lamports() != post.lamports;
let lamports_changed = pre.lamports() != post.lamports();
if lamports_changed {
if !is_writable {
return Err(InstructionError::ReadonlyLamportChange);
@ -171,7 +171,7 @@ impl PreAccount {
// executable is one-way (false->true) and only the account owner may set it.
let executable_changed = pre.executable() != post.executable();
if executable_changed {
if !rent.is_exempt(post.lamports, post.data().len()) {
if !rent.is_exempt(post.lamports(), post.data().len()) {
return Err(InstructionError::ExecutableAccountNotRentExempt);
}
if !is_writable // line coverage used to get branch coverage
@ -220,7 +220,7 @@ impl PreAccount {
}
pub fn lamports(&self) -> u64 {
self.account.borrow().lamports
self.account.borrow().lamports()
}
pub fn is_zeroed(buf: &[u8]) -> bool {
@ -1054,7 +1054,7 @@ impl MessageProcessor {
true,
)?;
pre_sum += u128::from(pre_accounts[unique_index].lamports());
post_sum += u128::from(account.lamports);
post_sum += u128::from(account.lamports());
Ok(())
};
instruction.visit_each_account(&mut work)?;
@ -1109,7 +1109,7 @@ impl MessageProcessor {
false,
)?;
pre_sum += u128::from(pre_account.lamports());
post_sum += u128::from(account.lamports);
post_sum += u128::from(account.lamports());
if is_writable && !account.executable() {
pre_account.update(&account);
}