@@ -1031,6 +1031,12 @@ fn test_splice_in_and_out() {
10311031
10321032#[ test]
10331033fn test_fails_initiating_concurrent_splices ( ) {
1034+ fails_initiating_concurrent_splices ( true ) ;
1035+ fails_initiating_concurrent_splices ( false ) ;
1036+ }
1037+
1038+ #[ cfg( test) ]
1039+ fn fails_initiating_concurrent_splices ( reconnect : bool ) {
10341040 let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
10351041 let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
10361042 let config = test_default_channel_config ( ) ;
@@ -1043,6 +1049,7 @@ fn test_fails_initiating_concurrent_splices() {
10431049 let node_0_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
10441050 let node_1_id = nodes[ 1 ] . node . get_our_node_id ( ) ;
10451051
1052+ send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1_000 ) ;
10461053 provide_utxo_reserves ( & nodes, 2 , Amount :: ONE_BTC ) ;
10471054
10481055 let outputs = vec ! [ TxOut {
@@ -1116,15 +1123,23 @@ fn test_fails_initiating_concurrent_splices() {
11161123 expect_splice_pending_event ( & nodes[ 0 ] , & node_1_id) ;
11171124 expect_splice_pending_event ( & nodes[ 1 ] , & node_0_id) ;
11181125
1119- // Now that the splice is pending, another splice may be initiated.
1126+ // Now that the splice is pending, another splice may be initiated, but we must wait until
1127+ // the `splice_locked` exchange to send the initiator `stfu`.
11201128 assert ! ( nodes[ 0 ] . node. splice_channel( & channel_id, & node_1_id, feerate) . is_ok( ) ) ;
11211129
1130+ if reconnect {
1131+ nodes[ 0 ] . node . peer_disconnected ( node_1_id) ;
1132+ nodes[ 1 ] . node . peer_disconnected ( node_0_id) ;
1133+ reconnect_nodes ( ReconnectArgs :: new ( & nodes[ 0 ] , & nodes[ 1 ] ) ) ;
1134+ }
1135+
1136+ assert ! ( nodes[ 0 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
1137+ assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
1138+
11221139 mine_transaction ( & nodes[ 0 ] , & splice_tx) ;
11231140 mine_transaction ( & nodes[ 1 ] , & splice_tx) ;
11241141 let stfu = lock_splice_after_blocks ( & nodes[ 0 ] , & nodes[ 1 ] , ANTI_REORG_DELAY - 1 ) ;
11251142
1126- // However, the acceptor had enqueued a quiescent action while the splice was pending, so it
1127- // will now attempt to initiate quiescence.
11281143 assert ! (
11291144 matches!( stfu, Some ( MessageSendEvent :: SendStfu { node_id, .. } ) if node_id == node_0_id)
11301145 ) ;
0 commit comments