mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 15:27:57 +00:00
Fix a race conditon in the pool when transactions are imported during pruning. (#2136)
* Store recently pruned tags to avoid re-importing transactions. * Update core/transaction-pool/graph/src/base_pool.rs * Update core/transaction-pool/graph/src/base_pool.rs * Update core/transaction-pool/graph/src/base_pool.rs * Update base_pool.rs
This commit is contained in:
@@ -517,18 +517,18 @@ mod tests {
|
||||
tx3.provides = vec![vec![4]];
|
||||
|
||||
// when
|
||||
let x = WaitingTransaction::new(tx2, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx2, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
let x = WaitingTransaction::new(tx3, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx3, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
assert_eq!(ready.get().count(), 2);
|
||||
|
||||
// too low priority
|
||||
let x = WaitingTransaction::new(tx1.clone(), &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx1.clone(), &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap_err();
|
||||
|
||||
tx1.priority = 10;
|
||||
let x = WaitingTransaction::new(tx1.clone(), &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx1.clone(), &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
|
||||
// then
|
||||
@@ -562,15 +562,15 @@ mod tests {
|
||||
};
|
||||
|
||||
// when
|
||||
let x = WaitingTransaction::new(tx1, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx1, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
let x = WaitingTransaction::new(tx2, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx2, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
let x = WaitingTransaction::new(tx3, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx3, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
let x = WaitingTransaction::new(tx4, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx4, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
let x = WaitingTransaction::new(tx5, &ready.provided_tags());
|
||||
let x = WaitingTransaction::new(tx5, &ready.provided_tags(), &[]);
|
||||
ready.import(x).unwrap();
|
||||
|
||||
// then
|
||||
|
||||
Reference in New Issue
Block a user