Readonlyaccounts (#16743)

* lamports -> lamports()

* format
This commit is contained in:
Jeff Washington (jwash)
2021-04-22 15:04:55 -05:00
committed by GitHub
parent 636b5987af
commit fc12841d95
9 changed files with 20 additions and 16 deletions

View File

@ -36,7 +36,7 @@ impl<'a> KeyedAccount<'a> {
}
pub fn lamports(&self) -> Result<u64, InstructionError> {
Ok(self.try_borrow()?.lamports)
Ok(self.try_borrow()?.lamports())
}
pub fn data_len(&self) -> Result<usize, InstructionError> {

View File

@ -267,6 +267,7 @@ where
mod test {
use super::*;
use crate::{
account::ReadableAccount,
account_utils::State as AccountUtilsState,
keyed_account::KeyedAccount,
nonce::{self, State},
@ -610,9 +611,12 @@ mod test {
// Deinitializes Account state
assert_eq!(state, State::Uninitialized);
// Empties Account balance
assert_eq!(nonce_keyed.account.borrow().lamports, expect_nonce_lamports);
assert_eq!(
nonce_keyed.account.borrow().lamports(),
expect_nonce_lamports
);
// Account balance goes to `to`
assert_eq!(to_keyed.account.borrow().lamports, expect_to_lamports);
assert_eq!(to_keyed.account.borrow().lamports(), expect_to_lamports);
})
})
}