connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1);
assert_eq!(Vec::<Balance>::new(),
nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances());
+
+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
+ // monitor events or claimable balances.
+ for node in nodes.iter() {
+ connect_blocks(node, 6);
+ connect_blocks(node, 6);
+ assert!(node.chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
+ assert!(node.chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
+ }
}
#[test]
connect_blocks(&nodes[0], node_a_htlc_claimable - nodes[0].best_block_info().1);
assert!(nodes[0].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
test_spendable_output(&nodes[0], &as_txn[1]);
+
+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
+ // monitor events or claimable balances.
+ connect_blocks(&nodes[0], 6);
+ connect_blocks(&nodes[0], 6);
+ assert!(nodes[0].chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
+ assert!(nodes[0].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
}
#[test]
connect_blocks(&nodes[1], 1);
assert!(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
+
+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
+ // monitor events or claimable balances.
+ connect_blocks(&nodes[1], 6);
+ connect_blocks(&nodes[1], 6);
+ assert!(nodes[1].chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
+ assert!(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
}
fn sorted_vec_with_additions<T: Ord + Clone>(v_orig: &Vec<T>, extra_ts: &[&T]) -> Vec<T> {
test_spendable_output(&nodes[1], &claim_txn[1]);
expect_payment_failed!(nodes[1], timeout_payment_hash, false);
assert_eq!(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances(), Vec::new());
+
+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
+ // monitor events or claimable balances.
+ connect_blocks(&nodes[1], 6);
+ connect_blocks(&nodes[1], 6);
+ assert!(nodes[1].chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
+ assert!(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
}
#[test]
test_spendable_output(&nodes[0], &as_second_htlc_claim_tx[1]);
assert_eq!(nodes[0].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances(), Vec::new());
+
+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
+ // monitor events or claimable balances.
+ connect_blocks(&nodes[0], 6);
+ connect_blocks(&nodes[0], 6);
+ assert!(nodes[0].chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
+ assert!(nodes[0].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
}
#[test]
expect_payment_failed!(nodes[1], revoked_payment_hash, false);
test_spendable_output(&nodes[1], &claim_txn_2[0]);
assert!(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
+
+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
+ // monitor events or claimable balances.
+ connect_blocks(&nodes[1], 6);
+ connect_blocks(&nodes[1], 6);
+ assert!(nodes[1].chain_monitor.chain_monitor.get_and_clear_pending_events().is_empty());
+ assert!(nodes[1].chain_monitor.chain_monitor.get_monitor(funding_outpoint).unwrap().get_claimable_balances().is_empty());
}