Return error for excluded secondary-index keys (#17193)
* Add runtime helpers to check secondary indexes for key * Add custom rpc error * Check secondary-index key inclusion in rpc * Clone complete AccountSecondaryIndexes into rpc to avoid bank query
This commit is contained in:
@ -715,6 +715,10 @@ impl Accounts {
|
||||
.0
|
||||
}
|
||||
|
||||
pub fn account_indexes_include_key(&self, key: &Pubkey) -> bool {
|
||||
self.accounts_db.account_indexes.include_key(key)
|
||||
}
|
||||
|
||||
pub fn load_all(&self, ancestors: &Ancestors) -> Vec<(Pubkey, AccountSharedData, Slot)> {
|
||||
self.accounts_db.scan_accounts(
|
||||
ancestors,
|
||||
|
@ -4246,6 +4246,10 @@ impl Bank {
|
||||
.load_by_index_key_with_filter(&self.ancestors, index_key, filter)
|
||||
}
|
||||
|
||||
pub fn account_indexes_include_key(&self, key: &Pubkey) -> bool {
|
||||
self.rc.accounts.account_indexes_include_key(key)
|
||||
}
|
||||
|
||||
pub fn get_all_accounts_with_modified_slots(&self) -> Vec<(Pubkey, AccountSharedData, Slot)> {
|
||||
self.rc.accounts.load_all(&self.ancestors)
|
||||
}
|
||||
|
Reference in New Issue
Block a user