@@ -2676,6 +2676,77 @@ fn test_splice_locked_waits_for_channel_reestablish() {
26762676 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1_000_000 ) ;
26772677}
26782678
2679+ #[ test]
2680+ fn test_splice_reestablish_waits_for_holder_tx_signatures_before_commitment_signed ( ) {
2681+ let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
2682+ let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
2683+ let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
2684+ let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
2685+
2686+ let node_id_0 = nodes[ 0 ] . node . get_our_node_id ( ) ;
2687+ let node_id_1 = nodes[ 1 ] . node . get_our_node_id ( ) ;
2688+
2689+ let initial_channel_value_sat = 100_000 ;
2690+ let ( _, _, channel_id, _) =
2691+ create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , initial_channel_value_sat, 0 ) ;
2692+
2693+ let outputs = vec ! [ TxOut {
2694+ value: Amount :: from_sat( initial_channel_value_sat / 4 ) ,
2695+ script_pubkey: nodes[ 0 ] . wallet_source. get_change_script( ) . unwrap( ) ,
2696+ } ] ;
2697+ let initiator_contribution =
2698+ initiate_splice_out ( & nodes[ 0 ] , & nodes[ 1 ] , channel_id, outputs) . unwrap ( ) ;
2699+ negotiate_splice_tx ( & nodes[ 0 ] , & nodes[ 1 ] , channel_id, initiator_contribution) ;
2700+
2701+ let signing_event = get_event ! ( nodes[ 0 ] , Event :: FundingTransactionReadyForSigning ) ;
2702+ assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
2703+
2704+ // Drop the acceptor's initial `commitment_signed`. On reconnection, node 0's
2705+ // `channel_reestablish` should request it again, while node 1's `channel_reestablish` should
2706+ // not make node 0 retransmit a `commitment_signed` before holder transaction signatures are
2707+ // available.
2708+ let _ = get_htlc_update_msgs ( & nodes[ 1 ] , & node_id_0) ;
2709+ nodes[ 0 ] . node . peer_disconnected ( node_id_1) ;
2710+ nodes[ 1 ] . node . peer_disconnected ( node_id_0) ;
2711+
2712+ let mut reconnect_args = ReconnectArgs :: new ( & nodes[ 0 ] , & nodes[ 1 ] ) ;
2713+ reconnect_args. send_announcement_sigs = ( true , true ) ;
2714+ reconnect_args. send_interactive_tx_commit_sig = ( true , false ) ;
2715+ reconnect_nodes ( reconnect_args) ;
2716+
2717+ assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
2718+ assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
2719+
2720+ let unsigned_transaction = if let Event :: FundingTransactionReadyForSigning {
2721+ unsigned_transaction,
2722+ ..
2723+ } = signing_event
2724+ {
2725+ unsigned_transaction
2726+ } else {
2727+ panic ! ( "Expected FundingTransactionReadyForSigning event" ) ;
2728+ } ;
2729+ let tx = nodes[ 0 ] . wallet_source . sign_tx ( unsigned_transaction) . unwrap ( ) ;
2730+ nodes[ 0 ] . node . funding_transaction_signed ( & channel_id, & node_id_1, tx) . unwrap ( ) ;
2731+ check_added_monitors ( & nodes[ 0 ] , 1 ) ;
2732+
2733+ let initiator_commit_sig = get_htlc_update_msgs ( & nodes[ 0 ] , & node_id_1) ;
2734+ nodes[ 1 ]
2735+ . node
2736+ . handle_commitment_signed_batch_test ( node_id_0, & initiator_commit_sig. commitment_signed ) ;
2737+ check_added_monitors ( & nodes[ 1 ] , 1 ) ;
2738+
2739+ let acceptor_tx_signatures =
2740+ get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendTxSignatures , node_id_0) ;
2741+ nodes[ 0 ] . node . handle_tx_signatures ( node_id_1, & acceptor_tx_signatures) ;
2742+ let initiator_tx_signatures =
2743+ get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendTxSignatures , node_id_1) ;
2744+ nodes[ 1 ] . node . handle_tx_signatures ( node_id_0, & initiator_tx_signatures) ;
2745+
2746+ expect_splice_pending_event ( & nodes[ 0 ] , & node_id_1) ;
2747+ expect_splice_pending_event ( & nodes[ 1 ] , & node_id_0) ;
2748+ }
2749+
26792750#[ test]
26802751fn test_splice_confirms_on_both_sides_while_disconnected ( ) {
26812752 // Regression test: when a splice transaction confirms on both sides while peers are
0 commit comments