@@ -844,6 +844,9 @@ fn do_test_retries_own_commitment_broadcast_after_reorg(anchors: bool, revoked_c
844844 check_closed_broadcast ( & nodes[ 0 ] , 1 , true ) ;
845845 check_added_monitors ( & nodes[ 0 ] , 1 ) ;
846846 check_closed_event ( & nodes[ 0 ] , 1 , ClosureReason :: HTLCsTimedOut , false , & [ nodes[ 1 ] . node . get_our_node_id ( ) ] , 100_000 ) ;
847+ if anchors {
848+ handle_bump_close_event ( & nodes[ 0 ] ) ;
849+ }
847850
848851 {
849852 let mut txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
@@ -870,6 +873,9 @@ fn do_test_retries_own_commitment_broadcast_after_reorg(anchors: bool, revoked_c
870873 check_added_monitors ( & nodes[ 1 ] , 1 ) ;
871874 let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) , message } ;
872875 check_closed_event ( & nodes[ 1 ] , 1 , reason, false , & [ nodes[ 0 ] . node . get_our_node_id ( ) ] , 100_000 ) ;
876+ if anchors {
877+ handle_bump_close_event ( & nodes[ 1 ] ) ;
878+ }
873879
874880 let commitment_b = {
875881 let mut txn = nodes[ 1 ] . tx_broadcaster . txn_broadcast ( ) ;
@@ -882,13 +888,23 @@ fn do_test_retries_own_commitment_broadcast_after_reorg(anchors: bool, revoked_c
882888 // Confirm B's commitment, A should now broadcast an HTLC timeout for commitment B.
883889 mine_transaction ( & nodes[ 0 ] , & commitment_b) ;
884890 {
885- let mut txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
886891 if nodes[ 0 ] . connect_style . borrow ( ) . updates_best_block_first ( ) {
887892 // `commitment_a` is rebroadcast because the best block was updated prior to seeing
888893 // `commitment_b`.
889- assert_eq ! ( txn. len( ) , 2 ) ;
890- check_spends ! ( txn. last( ) . unwrap( ) , commitment_b) ;
894+ if anchors {
895+ handle_bump_close_event ( & nodes[ 0 ] ) ;
896+ let mut txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
897+ assert_eq ! ( txn. len( ) , 3 ) ;
898+ check_spends ! ( txn[ 0 ] , commitment_b) ;
899+ check_spends ! ( txn[ 1 ] , funding_tx) ;
900+ check_spends ! ( txn[ 2 ] , txn[ 1 ] ) ; // Anchor output spend transaction.
901+ } else {
902+ let mut txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
903+ assert_eq ! ( txn. len( ) , 2 ) ;
904+ check_spends ! ( txn. last( ) . unwrap( ) , commitment_b) ;
905+ }
891906 } else {
907+ let mut txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
892908 assert_eq ! ( txn. len( ) , 1 ) ;
893909 check_spends ! ( txn[ 0 ] , commitment_b) ;
894910 }
@@ -898,11 +914,15 @@ fn do_test_retries_own_commitment_broadcast_after_reorg(anchors: bool, revoked_c
898914 // blocks, one to get us back to the original height, and another to retry our pending claims.
899915 disconnect_blocks ( & nodes[ 0 ] , 1 ) ;
900916 connect_blocks ( & nodes[ 0 ] , 2 ) ;
917+ if anchors {
918+ handle_bump_close_event ( & nodes[ 0 ] ) ;
919+ }
901920 {
902921 let mut txn = nodes[ 0 ] . tx_broadcaster . unique_txn_broadcast ( ) ;
903922 if anchors {
904- assert_eq ! ( txn. len( ) , 1 ) ;
923+ assert_eq ! ( txn. len( ) , 2 ) ;
905924 check_spends ! ( txn[ 0 ] , funding_tx) ;
925+ check_spends ! ( txn[ 1 ] , txn[ 0 ] ) ; // Anchor output spend.
906926 } else {
907927 assert_eq ! ( txn. len( ) , 2 ) ;
908928 check_spends ! ( txn[ 0 ] , txn[ 1 ] ) ; // HTLC timeout A
@@ -977,6 +997,7 @@ fn do_test_split_htlc_expiry_tracking(use_third_htlc: bool, reorg_out: bool) {
977997 let message = "Channel force-closed" . to_owned ( ) ;
978998 let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) , message } ;
979999 check_closed_event ( & nodes[ 1 ] , 1 , reason, false , & [ node_a_id] , 10_000_000 ) ;
1000+ handle_bump_close_event ( & nodes[ 1 ] ) ;
9801001
9811002 let mut txn = nodes[ 1 ] . tx_broadcaster . txn_broadcast ( ) ;
9821003 assert_eq ! ( txn. len( ) , 1 ) ;
@@ -990,19 +1011,13 @@ fn do_test_split_htlc_expiry_tracking(use_third_htlc: bool, reorg_out: bool) {
9901011 check_added_monitors ( & nodes[ 0 ] , 1 ) ;
9911012
9921013 mine_transaction ( & nodes[ 1 ] , & commitment_tx) ;
993- let mut bump_events = nodes[ 1 ] . chain_monitor . chain_monitor . get_and_clear_pending_events ( ) ;
994- assert_eq ! ( bump_events. len( ) , 1 ) ;
995- match bump_events. pop ( ) . unwrap ( ) {
996- Event :: BumpTransaction ( bump_event) => {
997- nodes[ 1 ] . bump_tx_handler . handle_event ( & bump_event) ;
998- } ,
999- ev => panic ! ( "Unexpected event {ev:?}" ) ,
1000- }
1014+ handle_bump_events ( & nodes[ 1 ] , nodes[ 1 ] . connect_style . borrow ( ) . updates_best_block_first ( ) , 1 ) ;
10011015
10021016 let mut txn = nodes[ 1 ] . tx_broadcaster . txn_broadcast ( ) ;
10031017 if nodes[ 1 ] . connect_style . borrow ( ) . updates_best_block_first ( ) {
1004- assert_eq ! ( txn. len( ) , 2 , "{txn:?}" ) ;
1018+ assert_eq ! ( txn. len( ) , 3 , "{txn:?}" ) ;
10051019 check_spends ! ( txn[ 0 ] , funding_tx) ;
1020+ check_spends ! ( txn[ 1 ] , txn[ 0 ] ) ; // Anchor output spend.
10061021 } else {
10071022 assert_eq ! ( txn. len( ) , 1 , "{txn:?}" ) ;
10081023 }
0 commit comments