mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +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:
@@ -906,9 +906,9 @@ ServiceBuilder<
|
||||
let network = Arc::downgrade(&network);
|
||||
let transaction_pool_ = transaction_pool.clone();
|
||||
let events = transaction_pool.import_notification_stream()
|
||||
.for_each(move |_| {
|
||||
.for_each(move |hash| {
|
||||
if let Some(network) = network.upgrade() {
|
||||
network.trigger_repropagate();
|
||||
network.propagate_extrinsic(hash);
|
||||
}
|
||||
let status = transaction_pool_.status();
|
||||
telemetry!(SUBSTRATE_INFO; "txpool.import";
|
||||
|
||||
@@ -608,7 +608,7 @@ where
|
||||
H: std::hash::Hash + Eq + sp_runtime::traits::Member + sp_runtime::traits::MaybeSerialize,
|
||||
E: 'static + IntoPoolError + From<sp_transaction_pool::error::Error>,
|
||||
{
|
||||
fn transactions(&self) -> Vec<(H, <B as BlockT>::Extrinsic)> {
|
||||
fn transactions(&self) -> Vec<(H, B::Extrinsic)> {
|
||||
transactions_to_propagate(&*self.pool)
|
||||
}
|
||||
|
||||
@@ -660,6 +660,10 @@ where
|
||||
fn on_broadcasted(&self, propagations: HashMap<H, Vec<String>>) {
|
||||
self.pool.on_broadcasted(propagations)
|
||||
}
|
||||
|
||||
fn transaction(&self, hash: &H) -> Option<B::Extrinsic> {
|
||||
self.pool.ready_transaction(hash).map(|tx| tx.data().clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user