@@ -33,7 +33,7 @@ use ldk_node::payment::{
3333 ConfirmationStatus , PaymentDetails , PaymentDirection , PaymentKind , PaymentStatus ,
3434 UnifiedPaymentResult ,
3535} ;
36- use ldk_node:: { Builder , Event , NodeError } ;
36+ use ldk_node:: { Builder , ChannelShutdownState , Event , NodeError } ;
3737use lightning:: ln:: channelmanager:: PaymentId ;
3838use lightning:: routing:: gossip:: { NodeAlias , NodeId } ;
3939use lightning:: routing:: router:: RouteParametersConfig ;
@@ -2108,24 +2108,26 @@ async fn lsps2_client_trusts_lsp() {
21082108
21092109 service_node. sync_wallets ( ) . unwrap ( ) ;
21102110 client_node. sync_wallets ( ) . unwrap ( ) ;
2111- assert_eq ! (
2112- client_node
2113- . list_channels( )
2114- . iter( )
2115- . find( |c| c. counterparty_node_id == service_node_id)
2116- . unwrap( )
2117- . confirmations,
2118- Some ( 0 )
2119- ) ;
2120- assert_eq ! (
2121- service_node
2122- . list_channels( )
2123- . iter( )
2124- . find( |c| c. counterparty_node_id == client_node_id)
2125- . unwrap( )
2126- . confirmations,
2127- Some ( 0 )
2128- ) ;
2111+ let client_channel = client_node
2112+ . list_channels ( )
2113+ . into_iter ( )
2114+ . find ( |c| c. counterparty_node_id == service_node_id)
2115+ . unwrap ( ) ;
2116+ assert_eq ! ( client_channel. confirmations, Some ( 0 ) ) ;
2117+ assert ! ( matches!(
2118+ client_channel. channel_shutdown_state,
2119+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2120+ ) ) ;
2121+ let service_channel = service_node
2122+ . list_channels ( )
2123+ . into_iter ( )
2124+ . find ( |c| c. counterparty_node_id == client_node_id)
2125+ . unwrap ( ) ;
2126+ assert_eq ! ( service_channel. confirmations, Some ( 0 ) ) ;
2127+ assert ! ( matches!(
2128+ service_channel. channel_shutdown_state,
2129+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2130+ ) ) ;
21292131
21302132 // Now claim the JIT payment, which should release the funding transaction
21312133 let service_fee_msat = ( jit_amount_msat * channel_opening_fee_ppm as u64 ) / 1_000_000 ;
@@ -2152,24 +2154,26 @@ async fn lsps2_client_trusts_lsp() {
21522154 generate_blocks_and_wait ( & bitcoind. client , & electrsd. client , 6 ) . await ;
21532155 service_node. sync_wallets ( ) . unwrap ( ) ;
21542156 client_node. sync_wallets ( ) . unwrap ( ) ;
2155- assert_eq ! (
2156- client_node
2157- . list_channels( )
2158- . iter( )
2159- . find( |c| c. counterparty_node_id == service_node_id)
2160- . unwrap( )
2161- . confirmations,
2162- Some ( 6 )
2163- ) ;
2164- assert_eq ! (
2165- service_node
2166- . list_channels( )
2167- . iter( )
2168- . find( |c| c. counterparty_node_id == client_node_id)
2169- . unwrap( )
2170- . confirmations,
2171- Some ( 6 )
2172- ) ;
2157+ let client_channel = client_node
2158+ . list_channels ( )
2159+ . into_iter ( )
2160+ . find ( |c| c. counterparty_node_id == service_node_id)
2161+ . unwrap ( ) ;
2162+ assert_eq ! ( client_channel. confirmations, Some ( 6 ) ) ;
2163+ assert ! ( matches!(
2164+ client_channel. channel_shutdown_state,
2165+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2166+ ) ) ;
2167+ let service_channel = service_node
2168+ . list_channels ( )
2169+ . into_iter ( )
2170+ . find ( |c| c. counterparty_node_id == client_node_id)
2171+ . unwrap ( ) ;
2172+ assert_eq ! ( service_channel. confirmations, Some ( 6 ) ) ;
2173+ assert ! ( matches!(
2174+ service_channel. channel_shutdown_state,
2175+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2176+ ) ) ;
21732177}
21742178
21752179#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
@@ -2280,24 +2284,26 @@ async fn lsps2_lsp_trusts_client_but_client_does_not_claim() {
22802284 generate_blocks_and_wait ( & bitcoind. client , & electrsd. client , 6 ) . await ;
22812285 service_node. sync_wallets ( ) . unwrap ( ) ;
22822286 client_node. sync_wallets ( ) . unwrap ( ) ;
2283- assert_eq ! (
2284- client_node
2285- . list_channels( )
2286- . iter( )
2287- . find( |c| c. counterparty_node_id == service_node_id)
2288- . unwrap( )
2289- . confirmations,
2290- Some ( 6 )
2291- ) ;
2292- assert_eq ! (
2293- service_node
2294- . list_channels( )
2295- . iter( )
2296- . find( |c| c. counterparty_node_id == client_node_id)
2297- . unwrap( )
2298- . confirmations,
2299- Some ( 6 )
2300- ) ;
2287+ let client_channel = client_node
2288+ . list_channels ( )
2289+ . into_iter ( )
2290+ . find ( |c| c. counterparty_node_id == service_node_id)
2291+ . unwrap ( ) ;
2292+ assert_eq ! ( client_channel. confirmations, Some ( 6 ) ) ;
2293+ assert ! ( matches!(
2294+ client_channel. channel_shutdown_state,
2295+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2296+ ) ) ;
2297+ let service_channel = service_node
2298+ . list_channels ( )
2299+ . into_iter ( )
2300+ . find ( |c| c. counterparty_node_id == client_node_id)
2301+ . unwrap ( ) ;
2302+ assert_eq ! ( service_channel. confirmations, Some ( 6 ) ) ;
2303+ assert ! ( matches!(
2304+ service_channel. channel_shutdown_state,
2305+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2306+ ) ) ;
23012307}
23022308
23032309#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
@@ -2672,6 +2678,10 @@ async fn open_channel_with_all_with_anchors() {
26722678 assert ! ( channel. channel_value_sats > premine_amount_sat - anchor_reserve_sat - 500 ) ;
26732679 assert_eq ! ( channel. counterparty_node_id, node_b. node_id( ) ) ;
26742680 assert_eq ! ( channel. funding_txo. unwrap( ) , funding_txo) ;
2681+ assert ! ( matches!(
2682+ channel. channel_shutdown_state,
2683+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2684+ ) ) ;
26752685
26762686 node_a. stop ( ) . unwrap ( ) ;
26772687 node_b. stop ( ) . unwrap ( ) ;
@@ -2723,6 +2733,10 @@ async fn open_channel_with_all_without_anchors() {
27232733 assert ! ( channel. channel_value_sats > premine_amount_sat - 500 ) ;
27242734 assert_eq ! ( channel. counterparty_node_id, node_b. node_id( ) ) ;
27252735 assert_eq ! ( channel. funding_txo. unwrap( ) , funding_txo) ;
2736+ assert ! ( matches!(
2737+ channel. channel_shutdown_state,
2738+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2739+ ) ) ;
27262740
27272741 node_a. stop ( ) . unwrap ( ) ;
27282742 node_b. stop ( ) . unwrap ( ) ;
@@ -2766,6 +2780,10 @@ async fn splice_in_with_all_balance() {
27662780 assert_eq ! ( channels. len( ) , 1 ) ;
27672781 assert_eq ! ( channels[ 0 ] . channel_value_sats, channel_amount_sat) ;
27682782 assert_eq ! ( channels[ 0 ] . funding_txo. unwrap( ) , funding_txo) ;
2783+ assert ! ( matches!(
2784+ channels[ 0 ] . channel_shutdown_state,
2785+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2786+ ) ) ;
27692787
27702788 let balance_before_splice = node_a. list_balances ( ) . spendable_onchain_balance_sats ;
27712789 assert ! ( balance_before_splice > 0 ) ;
@@ -2787,6 +2805,10 @@ async fn splice_in_with_all_balance() {
27872805 let channels = node_a. list_channels ( ) ;
27882806 assert_eq ! ( channels. len( ) , 1 ) ;
27892807 let channel = & channels[ 0 ] ;
2808+ assert ! ( matches!(
2809+ channel. channel_shutdown_state,
2810+ None | Some ( ChannelShutdownState :: NotShuttingDown )
2811+ ) ) ;
27902812 assert ! (
27912813 channel. channel_value_sats > premine_amount_sat - anchor_reserve_sat - 1000 ,
27922814 "Channel value {} should be close to premined amount {} minus anchor reserve {} and fees" ,
0 commit comments