Refactor RPC subscriptions account handling (#9888)
* Switch subscriptions to use commitment instead of confirmations * Add bank method to return account and last-modified slot * Add last_modified_slot to subscription data and use to filter account subscriptions * Update tests to non-zero last_notified_slot * Add accounts subscriptions to test; fails at higher tx load * Pass BankForks to RpcSubscriptions * Use BankForks on add_account_subscription to properly initialize last_notified_slot * Bundle subscriptions * Check for non-equality * Use commitment to initialize last_notified_slot; revert context.slot chage
This commit is contained in:
@ -1816,12 +1816,14 @@ impl Bank {
|
||||
}
|
||||
|
||||
pub fn get_account(&self, pubkey: &Pubkey) -> Option<Account> {
|
||||
self.rc
|
||||
.accounts
|
||||
.load_slow(&self.ancestors, pubkey)
|
||||
self.get_account_modified_slot(pubkey)
|
||||
.map(|(acc, _slot)| acc)
|
||||
}
|
||||
|
||||
pub fn get_account_modified_slot(&self, pubkey: &Pubkey) -> Option<(Account, Slot)> {
|
||||
self.rc.accounts.load_slow(&self.ancestors, pubkey)
|
||||
}
|
||||
|
||||
// Exclude self to really fetch the parent Bank's account hash and data.
|
||||
//
|
||||
// Being idempotent is needed to make the lazy initialization possible,
|
||||
|
Reference in New Issue
Block a user