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:
Tomasz Drwięga
2019-12-04 19:16:00 +01:00
committed by Gavin Wood
parent 925b23a3cd
commit 1628ba3388
6 changed files with 85 additions and 35 deletions
@@ -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: