@@ -29,7 +29,7 @@ use electrum_client::ElectrumApi;
2929use ldk_node:: config:: { AsyncPaymentsRole , Config , ElectrumSyncConfig , EsploraSyncConfig } ;
3030use ldk_node:: entropy:: { generate_entropy_mnemonic, NodeEntropy } ;
3131use ldk_node:: io:: sqlite_store:: SqliteStore ;
32- use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentStatus } ;
32+ use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentStatus , TransactionType } ;
3333use ldk_node:: {
3434 Builder , CustomTlvRecord , Event , LightningBalance , Node , NodeError , PendingSweepBalance ,
3535} ;
@@ -765,14 +765,21 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
765765 node_a. sync_wallets ( ) . unwrap ( ) ;
766766 node_b. sync_wallets ( ) . unwrap ( ) ;
767767
768- // Check we now see the channel funding transaction as outbound.
769- assert_eq ! (
770- node_a
771- . list_payments_with_filter( |p| p. direction == PaymentDirection :: Outbound
772- && matches!( p. kind, PaymentKind :: Onchain { .. } ) )
773- . len( ) ,
774- 1
775- ) ;
768+ // Check we now see the channel funding transaction as outbound with the correct type.
769+ let funding_payments_a = node_a. list_payments_with_filter ( |p| {
770+ p. direction == PaymentDirection :: Outbound && matches ! ( p. kind, PaymentKind :: Onchain { .. } )
771+ } ) ;
772+ assert_eq ! ( funding_payments_a. len( ) , 1 ) ;
773+ match funding_payments_a[ 0 ] . kind {
774+ PaymentKind :: Onchain { ref tx_type, .. } => {
775+ assert ! (
776+ matches!( tx_type, Some ( TransactionType :: Funding { .. } ) ) ,
777+ "Expected Funding transaction type, got {:?}" ,
778+ tx_type
779+ ) ;
780+ } ,
781+ _ => panic ! ( "Unexpected payment kind" ) ,
782+ }
776783
777784 let onchain_fee_buffer_sat = 5000 ;
778785 let node_a_anchor_reserve_sat = if expect_anchor_channel { 25_000 } else { 0 } ;
@@ -1115,13 +1122,21 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
11151122 expect_channel_ready_event ! ( node_a, node_b. node_id( ) ) ;
11161123 expect_channel_ready_event ! ( node_b, node_a. node_id( ) ) ;
11171124
1118- assert_eq ! (
1119- node_a
1120- . list_payments_with_filter( |p| p. direction == PaymentDirection :: Inbound
1121- && matches!( p. kind, PaymentKind :: Onchain { .. } ) )
1122- . len( ) ,
1123- 2
1124- ) ;
1125+ let inbound_onchain_a = node_a. list_payments_with_filter ( |p| {
1126+ p. direction == PaymentDirection :: Inbound && matches ! ( p. kind, PaymentKind :: Onchain { .. } )
1127+ } ) ;
1128+ assert_eq ! ( inbound_onchain_a. len( ) , 2 ) ;
1129+ // The second inbound on-chain payment should be from the splice-out.
1130+ match inbound_onchain_a[ 1 ] . kind {
1131+ PaymentKind :: Onchain { ref tx_type, .. } => {
1132+ assert ! (
1133+ matches!( tx_type, Some ( TransactionType :: Splice { .. } ) ) ,
1134+ "Expected Splice transaction type, got {:?}" ,
1135+ tx_type
1136+ ) ;
1137+ } ,
1138+ _ => panic ! ( "Unexpected payment kind" ) ,
1139+ }
11251140
11261141 println ! ( "\n A splices in the splice-out payment from B" ) ;
11271142 let splice_in_sat = splice_out_sat;
@@ -1137,13 +1152,21 @@ pub(crate) async fn do_channel_full_cycle<E: ElectrumApi>(
11371152 expect_channel_ready_event ! ( node_a, node_b. node_id( ) ) ;
11381153 expect_channel_ready_event ! ( node_b, node_a. node_id( ) ) ;
11391154
1140- assert_eq ! (
1141- node_a
1142- . list_payments_with_filter( |p| p. direction == PaymentDirection :: Outbound
1143- && matches!( p. kind, PaymentKind :: Onchain { .. } ) )
1144- . len( ) ,
1145- 2
1146- ) ;
1155+ let outbound_onchain_a = node_a. list_payments_with_filter ( |p| {
1156+ p. direction == PaymentDirection :: Outbound && matches ! ( p. kind, PaymentKind :: Onchain { .. } )
1157+ } ) ;
1158+ assert_eq ! ( outbound_onchain_a. len( ) , 2 ) ;
1159+ // The second outbound on-chain payment should be from the splice-in.
1160+ match outbound_onchain_a[ 1 ] . kind {
1161+ PaymentKind :: Onchain { ref tx_type, .. } => {
1162+ assert ! (
1163+ matches!( tx_type, Some ( TransactionType :: Splice { .. } ) ) ,
1164+ "Expected Splice transaction type, got {:?}" ,
1165+ tx_type
1166+ ) ;
1167+ } ,
1168+ _ => panic ! ( "Unexpected payment kind" ) ,
1169+ }
11471170
11481171 println ! ( "\n B close_channel (force: {})" , force_close) ;
11491172 if force_close {
0 commit comments