From fe64cf654c935735bb9831b146f587d970799839 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Tue, 10 Sep 2024 09:50:39 -0500 Subject: [PATCH] bank::(un)lock_accounts generic (#2835) --- accounts-db/src/accounts.rs | 10 +++++----- runtime/src/bank.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/accounts-db/src/accounts.rs b/accounts-db/src/accounts.rs index 8de5431318a3a0..2584f900edbc49 100644 --- a/accounts-db/src/accounts.rs +++ b/accounts-db/src/accounts.rs @@ -514,9 +514,9 @@ impl Accounts { /// This function will prevent multiple threads from modifying the same account state at the /// same time #[must_use] - pub fn lock_accounts<'a>( + pub fn lock_accounts<'a, Tx: SVMMessage + 'a>( &self, - txs: impl Iterator, + txs: impl Iterator, tx_account_lock_limit: usize, ) -> Vec> { // Validate the account locks, then get iterator if successful validation. @@ -566,9 +566,9 @@ impl Accounts { } /// Once accounts are unlocked, new transactions that modify that state can enter the pipeline - pub fn unlock_accounts<'a>( + pub fn unlock_accounts<'a, Tx: SVMMessage + 'a>( &self, - txs_and_results: impl Iterator)> + Clone, + txs_and_results: impl Iterator)> + Clone, ) { if !txs_and_results.clone().any(|(_, res)| res.is_ok()) { return; @@ -578,7 +578,7 @@ impl Accounts { debug!("bank unlock accounts"); for (tx, res) in txs_and_results { if res.is_ok() { - let tx_account_locks = TransactionAccountLocksIterator::new(tx.message()); + let tx_account_locks = TransactionAccountLocksIterator::new(tx); account_locks.unlock_accounts(tx_account_locks.accounts_with_is_writable()); } } diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 7ad9c63ee0e468..f6f4f8edee9bb5 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -3425,9 +3425,9 @@ impl Bank { account_overrides } - pub fn unlock_accounts<'a>( + pub fn unlock_accounts<'a, Tx: SVMMessage + 'a>( &self, - txs_and_results: impl Iterator)> + Clone, + txs_and_results: impl Iterator)> + Clone, ) { self.rc.accounts.unlock_accounts(txs_and_results) }