Fix revalidation not revalidating multiple times (#5065)

This commit is contained in:
Nikolay Volf
2020-02-27 14:18:10 +03:00
committed by GitHub
parent d6aa8e954c
commit bad9647af9
3 changed files with 61 additions and 2 deletions
@@ -267,6 +267,34 @@ fn should_not_retain_invalid_hashes_from_retracted() {
assert_eq!(pool.status().ready, 0);
}
#[test]
fn should_revalidate_transaction_multiple_times() {
let xt = uxt(Alice, 209);
let (pool, _guard) = maintained_pool();
block_on(pool.submit_one(&BlockId::number(0), xt.clone())).expect("1. Imported");
assert_eq!(pool.status().ready, 1);
pool.api.push_block(1, vec![xt.clone()]);
// maintenance is in background
block_on(pool.maintain(block_event(1)));
block_on(futures_timer::Delay::new(BACKGROUND_REVALIDATION_INTERVAL*2));
block_on(pool.submit_one(&BlockId::number(0), xt.clone())).expect("1. Imported");
assert_eq!(pool.status().ready, 1);
pool.api.push_block(2, vec![]);
pool.api.add_invalid(&xt);
// maintenance is in background
block_on(pool.maintain(block_event(2)));
block_on(futures_timer::Delay::new(BACKGROUND_REVALIDATION_INTERVAL*2));
assert_eq!(pool.status().ready, 0);
}
#[test]
fn should_push_watchers_during_maintaince() {
fn alice_uxt(nonce: u64) -> Extrinsic {