mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
Fix quadratic iterations over transaction pool (#4736)
* transaction pool changes * service & network changes * address review * reduce future pool
This commit is contained in:
@@ -374,9 +374,9 @@ impl<Hash: hash::Hash + Member + Serialize, Ex: std::fmt::Debug> BasePool<Hash,
|
||||
///
|
||||
/// Includes both ready and future pool. For every hash in the `hashes`
|
||||
/// iterator an `Option` is produced (so the resulting `Vec` always have the same length).
|
||||
pub fn by_hash(&self, hashes: &[Hash]) -> Vec<Option<Arc<Transaction<Hash, Ex>>>> {
|
||||
let ready = self.ready.by_hash(hashes);
|
||||
let future = self.future.by_hash(hashes);
|
||||
pub fn by_hashes(&self, hashes: &[Hash]) -> Vec<Option<Arc<Transaction<Hash, Ex>>>> {
|
||||
let ready = self.ready.by_hashes(hashes);
|
||||
let future = self.future.by_hashes(hashes);
|
||||
|
||||
ready
|
||||
.into_iter()
|
||||
@@ -385,6 +385,11 @@ impl<Hash: hash::Hash + Member + Serialize, Ex: std::fmt::Debug> BasePool<Hash,
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Returns pool transaction by hash.
|
||||
pub fn ready_by_hash(&self, hash: &Hash) -> Option<Arc<Transaction<Hash, Ex>>> {
|
||||
self.ready.by_hash(hash)
|
||||
}
|
||||
|
||||
/// Makes sure that the transactions in the queues stay within provided limits.
|
||||
///
|
||||
/// Removes and returns worst transactions from the queues and all transactions that depend on them.
|
||||
|
||||
Reference in New Issue
Block a user