@@ -567,6 +567,16 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
567
567
connect_blocks ( & nodes[ 1 ] , ANTI_REORG_DELAY - 1 ) ;
568
568
assert_eq ! ( Vec :: <Balance >:: new( ) ,
569
569
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
+ }
570
580
}
571
581
572
582
#[ test]
@@ -750,6 +760,14 @@ fn test_balances_on_local_commitment_htlcs() {
750
760
connect_blocks ( & nodes[ 0 ] , node_a_htlc_claimable - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
751
761
assert ! ( nodes[ 0 ] . chain_monitor. chain_monitor. get_monitor( funding_outpoint) . unwrap( ) . get_claimable_balances( ) . is_empty( ) ) ;
752
762
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( ) ) ;
753
771
}
754
772
755
773
#[ test]
@@ -982,6 +1000,14 @@ fn test_no_preimage_inbound_htlc_balances() {
982
1000
983
1001
connect_blocks ( & nodes[ 1 ] , 1 ) ;
984
1002
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( ) ) ;
985
1011
}
986
1012
987
1013
fn 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
1231
1257
test_spendable_output ( & nodes[ 1 ] , & claim_txn[ 1 ] ) ;
1232
1258
expect_payment_failed ! ( nodes[ 1 ] , timeout_payment_hash, false ) ;
1233
1259
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( ) ) ;
1234
1268
}
1235
1269
1236
1270
#[ test]
@@ -1437,6 +1471,14 @@ fn test_revoked_counterparty_htlc_tx_balances() {
1437
1471
test_spendable_output ( & nodes[ 0 ] , & as_second_htlc_claim_tx[ 1 ] ) ;
1438
1472
1439
1473
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( ) ) ;
1440
1482
}
1441
1483
1442
1484
#[ test]
@@ -1628,4 +1670,12 @@ fn test_revoked_counterparty_aggregated_claims() {
1628
1670
expect_payment_failed ! ( nodes[ 1 ] , revoked_payment_hash, false ) ;
1629
1671
test_spendable_output ( & nodes[ 1 ] , & claim_txn_2[ 0 ] ) ;
1630
1672
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( ) ) ;
1631
1681
}
0 commit comments