Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Clone complete AccountSecondaryIndexes into rpc to avoid bank query
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyera Eulberg committed May 13, 2021
1 parent a9b23ce commit 32118af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use solana_metrics::inc_new_counter_info;
use solana_perf::packet::PACKET_DATA_SIZE;
use solana_runtime::{
accounts::AccountAddressFilter,
accounts_index::{AccountIndex, IndexKey},
accounts_index::{AccountIndex, AccountSecondaryIndexes, IndexKey},
bank::Bank,
bank_forks::{BankForks, SnapshotConfig},
commitment::{BlockCommitmentArray, BlockCommitmentCache, CommitmentSlots},
Expand Down Expand Up @@ -125,7 +125,7 @@ pub struct JsonRpcConfig {
pub enable_bigtable_ledger_storage: bool,
pub enable_bigtable_ledger_upload: bool,
pub max_multiple_accounts: Option<usize>,
pub account_indexes: HashSet<AccountIndex>,
pub account_indexes: AccountSecondaryIndexes,
pub rpc_threads: usize,
pub rpc_bigtable_timeout: Option<Duration>,
pub minimal_api: bool,
Expand Down Expand Up @@ -1706,7 +1706,7 @@ impl JsonRpcRequestProcessor {
.account_indexes
.contains(&AccountIndex::ProgramId)
{
if !bank.account_indexes_include_key(program_id) {
if !self.config.account_indexes.include_key(program_id) {
return Err(RpcCustomError::KeyExcludedFromSecondaryIndex {
index_key: program_id.to_string(),
}
Expand Down Expand Up @@ -1755,7 +1755,7 @@ impl JsonRpcRequestProcessor {
.account_indexes
.contains(&AccountIndex::SplTokenOwner)
{
if !bank.account_indexes_include_key(owner_key) {
if !self.config.account_indexes.include_key(owner_key) {
return Err(RpcCustomError::KeyExcludedFromSecondaryIndex {
index_key: owner_key.to_string(),
}
Expand Down Expand Up @@ -1803,7 +1803,7 @@ impl JsonRpcRequestProcessor {
.account_indexes
.contains(&AccountIndex::SplTokenMint)
{
if !bank.account_indexes_include_key(mint_key) {
if !self.config.account_indexes.include_key(mint_key) {
return Err(RpcCustomError::KeyExcludedFromSecondaryIndex {
index_key: mint_key.to_string(),
}
Expand Down
2 changes: 1 addition & 1 deletion validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,7 @@ pub fn main() {
rpc_bigtable_timeout: value_t!(matches, "rpc_bigtable_timeout", u64)
.ok()
.map(Duration::from_secs),
account_indexes: account_indexes.indexes.clone(),
account_indexes: account_indexes.clone(),
},
rpc_addrs: value_t!(matches, "rpc_port", u16).ok().map(|rpc_port| {
(
Expand Down

0 comments on commit 32118af

Please sign in to comment.