@@ -142,7 +142,7 @@ fn test_monitor_and_persister_update_fail() {
142
142
assert_eq ! ( updates. update_fulfill_htlcs. len( ) , 1 ) ;
143
143
nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & updates. update_fulfill_htlcs [ 0 ] ) ;
144
144
if let Some ( ref mut channel) = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) . by_id . get_mut ( & chan. 2 ) {
145
- if let Ok ( ( _, _, _ , update) ) = channel. commitment_signed ( & updates. commitment_signed , & node_cfgs [ 0 ] . fee_estimator , & node_cfgs[ 0 ] . logger ) {
145
+ if let Ok ( ( _, _, update) ) = channel. commitment_signed ( & updates. commitment_signed , & node_cfgs[ 0 ] . logger ) {
146
146
// Check that even though the persister is returning a TemporaryFailure,
147
147
// because the update is bogus, ultimately the error that's returned
148
148
// should be a PermanentFailure.
@@ -2561,8 +2561,8 @@ fn test_reconnect_dup_htlc_claims() {
2561
2561
2562
2562
#[ test]
2563
2563
fn test_temporary_error_during_shutdown ( ) {
2564
- // Test that temporary failures when updating the monitor's shutdown script do not prevent
2565
- // cooperative close.
2564
+ // Test that temporary failures when updating the monitor's shutdown script delay cooperative
2565
+ // close.
2566
2566
let mut config = test_default_channel_config ( ) ;
2567
2567
config. channel_options . commit_upfront_shutdown_pubkey = false ;
2568
2568
@@ -2575,9 +2575,41 @@ fn test_temporary_error_during_shutdown() {
2575
2575
2576
2576
* nodes[ 0 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = Some ( Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ) ;
2577
2577
* nodes[ 1 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = Some ( Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ) ;
2578
- close_channel ( & nodes[ 0 ] , & nodes[ 1 ] , & channel_id, funding_tx, false ) ;
2579
- check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
2578
+
2579
+ nodes[ 0 ] . node . close_channel ( & channel_id) . unwrap ( ) ;
2580
+ nodes[ 1 ] . node . handle_shutdown ( & nodes[ 0 ] . node . get_our_node_id ( ) , & InitFeatures :: known ( ) , & get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendShutdown , nodes[ 1 ] . node. get_our_node_id( ) ) ) ;
2580
2581
check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
2582
+
2583
+ nodes[ 0 ] . node . handle_shutdown ( & nodes[ 1 ] . node . get_our_node_id ( ) , & InitFeatures :: known ( ) , & get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendShutdown , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
2584
+ check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
2585
+
2586
+ assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
2587
+
2588
+ * nodes[ 0 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = None ;
2589
+ * nodes[ 1 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = None ;
2590
+
2591
+ let ( outpoint, latest_update) = nodes[ 0 ] . chain_monitor . latest_monitor_update_id . lock ( ) . unwrap ( ) . get ( & channel_id) . unwrap ( ) . clone ( ) ;
2592
+ nodes[ 0 ] . node . channel_monitor_updated ( & outpoint, latest_update) ;
2593
+ nodes[ 1 ] . node . handle_closing_signed ( & nodes[ 0 ] . node . get_our_node_id ( ) , & get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendClosingSigned , nodes[ 1 ] . node. get_our_node_id( ) ) ) ;
2594
+
2595
+ assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
2596
+
2597
+ * nodes[ 1 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = None ;
2598
+ let ( outpoint, latest_update) = nodes[ 1 ] . chain_monitor . latest_monitor_update_id . lock ( ) . unwrap ( ) . get ( & channel_id) . unwrap ( ) . clone ( ) ;
2599
+ nodes[ 1 ] . node . channel_monitor_updated ( & outpoint, latest_update) ;
2600
+
2601
+ nodes[ 0 ] . node . handle_closing_signed ( & nodes[ 1 ] . node . get_our_node_id ( ) , & get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendClosingSigned , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
2602
+ let ( _, closing_signed_a) = get_closing_signed_broadcast ! ( nodes[ 0 ] . node, nodes[ 1 ] . node. get_our_node_id( ) ) ;
2603
+ let txn_a = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
2604
+
2605
+ nodes[ 1 ] . node . handle_closing_signed ( & nodes[ 0 ] . node . get_our_node_id ( ) , & closing_signed_a. unwrap ( ) ) ;
2606
+ let ( _, none_b) = get_closing_signed_broadcast ! ( nodes[ 1 ] . node, nodes[ 0 ] . node. get_our_node_id( ) ) ;
2607
+ assert ! ( none_b. is_none( ) ) ;
2608
+ let txn_b = nodes[ 1 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) . split_off ( 0 ) ;
2609
+
2610
+ assert_eq ! ( txn_a, txn_b) ;
2611
+ assert_eq ! ( txn_a. len( ) , 1 ) ;
2612
+ check_spends ! ( txn_a[ 0 ] , funding_tx) ;
2581
2613
}
2582
2614
2583
2615
#[ test]
0 commit comments