Refactoring: Unify account_deps and accounts (#17898)

* Changes ThisInvokeContext::get_account() to use accounts instead of pre_accounts.

* Adds explicit keys to accounts to make them symmetric to account_deps.

* Appends account_deps to accounts in transaction loading and removes account_deps everywhere else.
This commit is contained in:
Alexander Meißner
2021-07-05 13:49:37 +02:00
committed by GitHub
parent ffb1f3932a
commit 7462c27d07
7 changed files with 289 additions and 308 deletions

View File

@ -3096,15 +3096,21 @@ pub mod rpc_full {
accounts.push(if result.is_err() {
None
} else {
transaction
.message
.account_keys
.iter()
.position(|pubkey| *pubkey == address)
.map(|i| post_simulation_accounts.get(i))
.flatten()
.map(|account| {
UiAccount::encode(&address, account, accounts_encoding, None, None)
(0..transaction.message.account_keys.len())
.position(|i| {
post_simulation_accounts
.get(i)
.map(|(key, _account)| *key == address)
.unwrap_or(false)
})
.map(|i| {
UiAccount::encode(
&address,
&post_simulation_accounts[i].1,
accounts_encoding,
None,
None,
)
})
});
}