mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Revalidate some transactions on every block import. (#4292)
* Revalidate some transactions on every block import. * Fix endless loop in revalidate_ready. * Clean up logging a bit. * More clean ups. * Print status after resubmitting. * Remove env_logger. * Remove redundant log.
This commit is contained in:
committed by
Gavin Wood
parent
925b23a3cd
commit
1628ba3388
@@ -106,7 +106,12 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
.map(|validated_tx| self.submit_one(validated_tx))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let removed = self.enforce_limits();
|
||||
// only enforce limits if there is at least one imported transaction
|
||||
let removed = if results.iter().any(|res| res.is_ok()) {
|
||||
self.enforce_limits()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
|
||||
results.into_iter().map(|res| match res {
|
||||
Ok(ref hash) if removed.contains(hash) => Err(error::Error::ImmediatelyDropped.into()),
|
||||
@@ -236,6 +241,8 @@ impl<B: ChainApi> ValidatedPool<B> {
|
||||
initial_statuses.insert(removed_hash.clone(), Status::Ready);
|
||||
txs_to_resubmit.push((removed_hash, tx_to_resubmit));
|
||||
}
|
||||
// make sure to remove the hash even if it's not present in the pool any more.
|
||||
updated_transactions.remove(&hash);
|
||||
}
|
||||
|
||||
// if we're rejecting future transactions, then insertion order matters here:
|
||||
|
||||
Reference in New Issue
Block a user