@@ -378,6 +378,41 @@ fn test_multi_flight_update_fee() {
378378 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
379379}
380380
381+ #[ test]
382+ fn test_1_conf_open ( ) {
383+ // Previously, if the minium_depth config was set to 1, we'd never send a funding_locked. This
384+ // tests that we properly send one in that case.
385+ let mut alice_config = UserConfig :: default ( ) ;
386+ alice_config. own_channel_config . minimum_depth = 1 ;
387+ alice_config. channel_options . announced_channel = true ;
388+ alice_config. peer_channel_config_limits . force_announced_channel_preference = false ;
389+ let mut bob_config = UserConfig :: default ( ) ;
390+ bob_config. own_channel_config . minimum_depth = 1 ;
391+ bob_config. channel_options . announced_channel = true ;
392+ bob_config. peer_channel_config_limits . force_announced_channel_preference = false ;
393+ let node_cfgs = create_node_cfgs ( 2 ) ;
394+ let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ Some ( alice_config) , Some ( bob_config) ] ) ;
395+ let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
396+
397+ let tx = create_chan_between_nodes_with_value_init ( & nodes[ 0 ] , & nodes[ 1 ] , 100000 , 10001 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
398+ assert ! ( nodes[ 0 ] . chain_monitor. does_match_tx( & tx) ) ;
399+ assert ! ( nodes[ 1 ] . chain_monitor. does_match_tx( & tx) ) ;
400+
401+ let header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
402+ nodes[ 1 ] . block_notifier . block_connected_checked ( & header, 1 , & [ & tx; 1 ] , & [ tx. version ; 1 ] ) ;
403+ nodes[ 0 ] . node . handle_funding_locked ( & nodes[ 1 ] . node . get_our_node_id ( ) , & get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendFundingLocked , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
404+
405+ nodes[ 0 ] . block_notifier . block_connected_checked ( & header, 1 , & [ & tx; 1 ] , & [ tx. version ; 1 ] ) ;
406+ let ( funding_locked, _) = create_chan_between_nodes_with_value_confirm_second ( & nodes[ 1 ] , & nodes[ 0 ] ) ;
407+ let ( announcement, as_update, bs_update) = create_chan_between_nodes_with_value_b ( & nodes[ 0 ] , & nodes[ 1 ] , & funding_locked) ;
408+
409+ for node in nodes {
410+ assert ! ( node. router. handle_channel_announcement( & announcement) . unwrap( ) ) ;
411+ node. router . handle_channel_update ( & as_update) . unwrap ( ) ;
412+ node. router . handle_channel_update ( & bs_update) . unwrap ( ) ;
413+ }
414+ }
415+
381416#[ test]
382417fn test_update_fee_vanilla ( ) {
383418 let node_cfgs = create_node_cfgs ( 2 ) ;
0 commit comments