CLI flag to configure tx ban duration (#11786)

* add tx-ban-seconds

* fix

* trigger CI

* trigger CI

* remove test print

* Update client/cli/src/params/transaction_pool_params.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
Xiliang Chen
2022-07-12 23:19:13 +12:00
committed by GitHub
parent a1c60f0909
commit 47b27c292f
7 changed files with 31 additions and 7 deletions
@@ -51,6 +51,11 @@ impl<Hash: hash::Hash + Eq> Default for PoolRotator<Hash> {
}
impl<Hash: hash::Hash + Eq + Clone> PoolRotator<Hash> {
/// New rotator instance with specified ban time.
pub fn new(ban_time: Duration) -> Self {
Self { ban_time, banned_until: Default::default() }
}
/// Returns `true` if extrinsic hash is currently banned.
pub fn is_banned(&self, hash: &Hash) -> bool {
self.banned_until.read().contains_key(hash)