@@ -261,16 +261,19 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool) {
261261 }
262262
263263 // ...and make sure we can force-close a frozen channel
264- let err_msg = "Channel force-closed" . to_owned ( ) ;
265- nodes[ 0 ] . node . force_close_broadcasting_latest_txn ( & channel_id, & node_b_id, err_msg) . unwrap ( ) ;
264+ let message = "Channel force-closed" . to_owned ( ) ;
265+ let reason = ClosureReason :: HolderForceClosed {
266+ broadcasted_latest_txn : Some ( true ) ,
267+ message : message. clone ( ) ,
268+ } ;
269+ nodes[ 0 ] . node . force_close_broadcasting_latest_txn ( & channel_id, & node_b_id, message) . unwrap ( ) ;
266270 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
267271 check_closed_broadcast ! ( nodes[ 0 ] , true ) ;
268272
269273 // TODO: Once we hit the chain with the failure transaction we should check that we get a
270274 // PaymentPathFailed event
271275
272276 assert_eq ! ( nodes[ 0 ] . node. list_channels( ) . len( ) , 0 ) ;
273- let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
274277 check_closed_event ! ( nodes[ 0 ] , 1 , reason, [ node_b_id] , 100000 ) ;
275278}
276279
@@ -3757,27 +3760,30 @@ fn do_test_durable_preimages_on_closed_channel(
37573760 let _ = get_revoke_commit_msgs ! ( nodes[ 1 ] , node_c_id) ;
37583761
37593762 let mon_bc = get_monitor ! ( nodes[ 1 ] , chan_id_bc) . encode ( ) ;
3760- let err_msg = "Channel force-closed" . to_owned ( ) ;
37613763
37623764 if close_chans_before_reload {
37633765 if !close_only_a {
37643766 chanmon_cfgs[ 1 ] . persister . set_update_ret ( ChannelMonitorUpdateStatus :: InProgress ) ;
3767+ let message = "Channel force-closed" . to_owned ( ) ;
37653768 nodes[ 1 ]
37663769 . node
3767- . force_close_broadcasting_latest_txn ( & chan_id_bc, & node_c_id, err_msg . clone ( ) )
3770+ . force_close_broadcasting_latest_txn ( & chan_id_bc, & node_c_id, message . clone ( ) )
37683771 . unwrap ( ) ;
37693772 check_closed_broadcast ( & nodes[ 1 ] , 1 , true ) ;
3770- let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
3773+ let reason =
3774+ ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) , message } ;
37713775 check_closed_event ( & nodes[ 1 ] , 1 , reason, false , & [ node_c_id] , 100000 ) ;
37723776 }
37733777
37743778 chanmon_cfgs[ 1 ] . persister . set_update_ret ( ChannelMonitorUpdateStatus :: InProgress ) ;
3779+ let message = "Channel force-closed" . to_owned ( ) ;
37753780 nodes[ 1 ]
37763781 . node
3777- . force_close_broadcasting_latest_txn ( & chan_id_ab, & node_a_id, err_msg )
3782+ . force_close_broadcasting_latest_txn ( & chan_id_ab, & node_a_id, message . clone ( ) )
37783783 . unwrap ( ) ;
37793784 check_closed_broadcast ( & nodes[ 1 ] , 1 , true ) ;
3780- let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
3785+ let reason =
3786+ ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) , message } ;
37813787 check_closed_event ( & nodes[ 1 ] , 1 , reason, false , & [ node_a_id] , 100000 ) ;
37823788 }
37833789
@@ -3799,8 +3805,11 @@ fn do_test_durable_preimages_on_closed_channel(
37993805 }
38003806
38013807 let err_msg = "Channel force-closed" . to_owned ( ) ;
3808+ let reason = ClosureReason :: HolderForceClosed {
3809+ broadcasted_latest_txn : Some ( true ) ,
3810+ message : err_msg. clone ( ) ,
3811+ } ;
38023812 nodes[ 0 ] . node . force_close_broadcasting_latest_txn ( & chan_id_ab, & node_b_id, err_msg) . unwrap ( ) ;
3803- let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
38043813 check_closed_event ( & nodes[ 0 ] , 1 , reason, false , & [ node_b_id] , 100000 ) ;
38053814 let as_closing_tx = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
38063815 assert_eq ! ( as_closing_tx. len( ) , 1 ) ;
@@ -3964,10 +3973,13 @@ fn do_test_reload_mon_update_completion_actions(close_during_reload: bool) {
39643973 if close_during_reload {
39653974 // Test that we still free the B<->C channel if the A<->B channel closed while we reloaded
39663975 // (as learned about during the on-reload block connection).
3976+ let reason = ClosureReason :: HolderForceClosed {
3977+ broadcasted_latest_txn : Some ( true ) ,
3978+ message : msg. clone ( ) ,
3979+ } ;
39673980 nodes[ 0 ] . node . force_close_broadcasting_latest_txn ( & chan_id_ab, & node_b_id, msg) . unwrap ( ) ;
39683981 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
39693982 check_closed_broadcast ! ( nodes[ 0 ] , true ) ;
3970- let reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
39713983 check_closed_event ( & nodes[ 0 ] , 1 , reason, false , & [ node_b_id] , 100_000 ) ;
39723984 let as_closing_tx = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
39733985 mine_transaction_without_consistency_checks ( & nodes[ 1 ] , & as_closing_tx[ 0 ] ) ;
@@ -4292,12 +4304,13 @@ fn test_claim_to_closed_channel_blocks_forwarded_preimage_removal() {
42924304 let ( payment_preimage, payment_hash, ..) =
42934305 route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 1_000_000 ) ;
42944306
4307+ let message = "Channel force-closed" . to_owned ( ) ;
42954308 nodes[ 0 ]
42964309 . node
4297- . force_close_broadcasting_latest_txn ( & chan_a. 2 , & node_b_id, String :: new ( ) )
4310+ . force_close_broadcasting_latest_txn ( & chan_a. 2 , & node_b_id, message . clone ( ) )
42984311 . unwrap ( ) ;
42994312 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
4300- let a_reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
4313+ let a_reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) , message } ;
43014314 check_closed_event ! ( nodes[ 0 ] , 1 , a_reason, [ node_b_id] , 1000000 ) ;
43024315 check_closed_broadcast ! ( nodes[ 0 ] , true ) ;
43034316
@@ -4367,12 +4380,13 @@ fn test_claim_to_closed_channel_blocks_claimed_event() {
43674380
43684381 let ( payment_preimage, payment_hash, ..) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1_000_000 ) ;
43694382
4383+ let message = "Channel force-closed" . to_owned ( ) ;
43704384 nodes[ 0 ]
43714385 . node
4372- . force_close_broadcasting_latest_txn ( & chan_a. 2 , & node_b_id, String :: new ( ) )
4386+ . force_close_broadcasting_latest_txn ( & chan_a. 2 , & node_b_id, message . clone ( ) )
43734387 . unwrap ( ) ;
43744388 check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
4375- let a_reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) } ;
4389+ let a_reason = ClosureReason :: HolderForceClosed { broadcasted_latest_txn : Some ( true ) , message } ;
43764390 check_closed_event ! ( nodes[ 0 ] , 1 , a_reason, [ node_b_id] , 1000000 ) ;
43774391 check_closed_broadcast ! ( nodes[ 0 ] , true ) ;
43784392
0 commit comments