owner -> owner() (#16782)

This commit is contained in:
Jeff Washington (jwash)
2021-04-23 17:49:47 -05:00
committed by GitHub
parent 1a4a7059af
commit ca14c18998
9 changed files with 23 additions and 23 deletions

View File

@ -2,7 +2,7 @@ use solana_runtime::{
accounts_index::{AccountIndex, IndexKey},
bank::Bank,
};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::{account::ReadableAccount, pubkey::Pubkey};
use solana_stake_program::stake_state::StakeState;
use std::{collections::HashSet, sync::Arc};
@ -34,7 +34,7 @@ pub fn calculate_non_circulating_supply(bank: &Arc<Bank>) -> NonCirculatingSuppl
// the current AccountsDb implementation, an account may remain in storage as a
// zero-lamport Account::Default() after being wiped and reinitialized in later
// updates. We include the redundant filter here to avoid returning these accounts.
|account| account.owner == solana_stake_program::id(),
|account| account.owner() == &solana_stake_program::id(),
)
} else {
bank.get_program_accounts(&solana_stake_program::id())

View File

@ -1458,7 +1458,7 @@ impl JsonRpcRequestProcessor {
Error::invalid_params("Invalid param: could not find account".to_string())
})?;
if account.owner != spl_token_id_v2_0() {
if account.owner() != &spl_token_id_v2_0() {
return Err(Error::invalid_params(
"Invalid param: not a v2.0 Token account".to_string(),
));
@ -1482,7 +1482,7 @@ impl JsonRpcRequestProcessor {
let mint_account = bank.get_account(mint).ok_or_else(|| {
Error::invalid_params("Invalid param: could not find account".to_string())
})?;
if mint_account.owner != spl_token_id_v2_0() {
if mint_account.owner() != &spl_token_id_v2_0() {
return Err(Error::invalid_params(
"Invalid param: not a v2.0 Token mint".to_string(),
));
@ -1660,7 +1660,7 @@ impl JsonRpcRequestProcessor {
// zero-lamport AccountSharedData::Default() after being wiped and reinitialized in later
// updates. We include the redundant filters here to avoid returning these
// accounts.
account.owner == *program_id && filter_closure(account)
account.owner() == program_id && filter_closure(account)
})
} else {
bank.get_filtered_program_accounts(program_id, filter_closure)
@ -1696,7 +1696,7 @@ impl JsonRpcRequestProcessor {
.contains(&AccountIndex::SplTokenOwner)
{
bank.get_filtered_indexed_accounts(&IndexKey::SplTokenOwner(*owner_key), |account| {
account.owner == spl_token_id_v2_0()
account.owner() == &spl_token_id_v2_0()
&& filters.iter().all(|filter_type| match filter_type {
RpcFilterType::DataSize(size) => account.data().len() as u64 == *size,
RpcFilterType::Memcmp(compare) => compare.bytes_match(&account.data()),
@ -1735,7 +1735,7 @@ impl JsonRpcRequestProcessor {
.contains(&AccountIndex::SplTokenMint)
{
bank.get_filtered_indexed_accounts(&IndexKey::SplTokenMint(*mint_key), |account| {
account.owner == spl_token_id_v2_0()
account.owner() == &spl_token_id_v2_0()
&& filters.iter().all(|filter_type| match filter_type {
RpcFilterType::DataSize(size) => account.data().len() as u64 == *size,
RpcFilterType::Memcmp(compare) => compare.bytes_match(&account.data()),
@ -1838,7 +1838,7 @@ fn get_encoded_account(
) -> Result<Option<UiAccount>> {
let mut response = None;
if let Some(account) = bank.get_account(pubkey) {
if account.owner == spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
if account.owner() == &spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
response = Some(get_parsed_token_account(bank.clone(), pubkey, account));
} else if (encoding == UiAccountEncoding::Binary || encoding == UiAccountEncoding::Base58)
&& account.data().len() > 128
@ -2008,7 +2008,7 @@ fn get_mint_owner_and_decimals(bank: &Arc<Bank>, mint: &Pubkey) -> Result<(Pubke
Error::invalid_params("Invalid param: could not find mint".to_string())
})?;
let decimals = get_mint_decimals(&mint_account.data())?;
Ok((mint_account.owner, decimals))
Ok((*mint_account.owner(), decimals))
}
}

View File

@ -290,7 +290,7 @@ fn filter_account_result(
// and should notify that the account state has been reverted.
let results: Box<dyn Iterator<Item = UiAccount>> = if last_modified_slot != last_notified_slot {
let encoding = encoding.unwrap_or(UiAccountEncoding::Binary);
if account.owner == spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
if account.owner() == &spl_token_id_v2_0() && encoding == UiAccountEncoding::JsonParsed {
Box::new(iter::once(get_parsed_token_account(bank, pubkey, account)))
} else {
Box::new(iter::once(UiAccount::encode(