@@ -567,6 +567,16 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
567567 connect_blocks ( & nodes[ 1 ] , ANTI_REORG_DELAY - 1 ) ;
568568 assert_eq ! ( Vec :: <Balance >:: new( ) ,
569569 nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) ) ;
570+
571+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
572+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
573+ // monitor events or claimable balances.
574+ for node in nodes. iter ( ) {
575+ connect_blocks ( node, 6 ) ;
576+ connect_blocks ( node, 6 ) ;
577+ assert ! ( node. chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
578+ assert ! ( node. chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
579+ }
570580}
571581
572582#[ test]
@@ -750,6 +760,14 @@ fn test_balances_on_local_commitment_htlcs() {
750760 connect_blocks ( & nodes[ 0 ] , node_a_htlc_claimable - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
751761 assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
752762 test_spendable_output ( & nodes[ 0 ] , & as_txn[ 1 ] ) ;
763+
764+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
765+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
766+ // monitor events or claimable balances.
767+ connect_blocks ( & nodes[ 0 ] , 6 ) ;
768+ connect_blocks ( & nodes[ 0 ] , 6 ) ;
769+ assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
770+ assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
753771}
754772
755773#[ test]
@@ -982,6 +1000,14 @@ fn test_no_preimage_inbound_htlc_balances() {
9821000
9831001 connect_blocks ( & nodes[ 1 ] , 1 ) ;
9841002 assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
1003+
1004+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
1005+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
1006+ // monitor events or claimable balances.
1007+ connect_blocks ( & nodes[ 1 ] , 6 ) ;
1008+ connect_blocks ( & nodes[ 1 ] , 6 ) ;
1009+ assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
1010+ assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
9851011}
9861012
9871013fn sorted_vec_with_additions < T : Ord + Clone > ( v_orig : & Vec < T > , extra_ts : & [ & T ] ) -> Vec < T > {
@@ -1231,6 +1257,14 @@ fn do_test_revoked_counterparty_commitment_balances(confirm_htlc_spend_first: bo
12311257 test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 1 ] ) ;
12321258 expect_payment_failed ! ( nodes[ 1 ] , timeout_payment_hash, false ) ;
12331259 assert_eq ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) , Vec :: new( ) ) ;
1260+
1261+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
1262+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
1263+ // monitor events or claimable balances.
1264+ connect_blocks ( & nodes[ 1 ] , 6 ) ;
1265+ connect_blocks ( & nodes[ 1 ] , 6 ) ;
1266+ assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
1267+ assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
12341268}
12351269
12361270#[ test]
@@ -1437,6 +1471,14 @@ fn test_revoked_counterparty_htlc_tx_balances() {
14371471 test_spendable_output ( & nodes[ 0 ] , & as_second_htlc_claim_tx[ 1 ] ) ;
14381472
14391473 assert_eq ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) , Vec :: new( ) ) ;
1474+
1475+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
1476+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
1477+ // monitor events or claimable balances.
1478+ connect_blocks ( & nodes[ 0 ] , 6 ) ;
1479+ connect_blocks ( & nodes[ 0 ] , 6 ) ;
1480+ assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
1481+ assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
14401482}
14411483
14421484#[ test]
@@ -1628,4 +1670,12 @@ fn test_revoked_counterparty_aggregated_claims() {
16281670 expect_payment_failed ! ( nodes[ 1 ] , revoked_payment_hash, false ) ;
16291671 test_spendable_output ( & nodes[ 1 ] , & claim_txn_2[ 0 ] ) ;
16301672 assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
1673+
1674+ // Ensure that even if we connect more blocks, potentially replaying the entire chain if we're
1675+ // using `ConnectStyle::HighlyRedundantTransactionsFirstSkippingBlocks`, we don't get new
1676+ // monitor events or claimable balances.
1677+ connect_blocks ( & nodes[ 1 ] , 6 ) ;
1678+ connect_blocks ( & nodes[ 1 ] , 6 ) ;
1679+ assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_and_clear_pending_events( ) . is_empty( ) ) ;
1680+ assert ! ( nodes[ 1 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
16311681}
0 commit comments