-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.17: rpc: parse token accounts in simulate_transaction (backport of #…
…34619) (#34852) * rpc: parse token accounts in simulate_transaction (#34619) * rpc: parse token accounts in simulate_transaction * add overwrite_accounts into get_encoded_account and get_parsed_token_account * revert get_mint_decimals scope changes * move common.rs to rpc/account_resolver.rs * rename get_account to get_account_from_overwrites_or_bank * add a comment * clippy * add comment Co-authored-by: Tyera <[email protected]> --------- Co-authored-by: Tyera <[email protected]> (cherry picked from commit 7470c3d) * remove innerInstructions --------- Co-authored-by: Yihau Chen <[email protected]> Co-authored-by: yihau <[email protected]>
- Loading branch information
1 parent
407dfba
commit d878262
Showing
4 changed files
with
191 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use { | ||
solana_runtime::bank::Bank, | ||
solana_sdk::{account::AccountSharedData, pubkey::Pubkey}, | ||
std::collections::HashMap, | ||
}; | ||
|
||
pub(crate) fn get_account_from_overwrites_or_bank( | ||
pubkey: &Pubkey, | ||
bank: &Bank, | ||
overwrite_accounts: Option<&HashMap<Pubkey, AccountSharedData>>, | ||
) -> Option<AccountSharedData> { | ||
overwrite_accounts | ||
.and_then(|accounts| accounts.get(pubkey).cloned()) | ||
.or_else(|| bank.get_account(pubkey)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters