@@ -14,7 +14,7 @@ use logging::TestLogWriter;
1414
1515use ldk_node:: config:: { Config , ElectrumSyncConfig , EsploraSyncConfig } ;
1616use ldk_node:: io:: sqlite_store:: SqliteStore ;
17- use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentStatus } ;
17+ use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentMetadataDetail , PaymentStatus } ;
1818use ldk_node:: {
1919 Builder , CustomTlvRecord , Event , LightningBalance , Node , NodeError , PendingSweepBalance ,
2020} ;
@@ -653,10 +653,23 @@ pub(crate) fn do_channel_full_cycle<E: ElectrumApi>(
653653 } ) ;
654654 assert_eq ! ( outbound_payments_b. len( ) , 0 ) ;
655655
656- let inbound_payments_b = node_b. list_payments_with_filter ( |p| {
657- p. direction == PaymentDirection :: Inbound && matches ! ( p. kind, PaymentKind :: Bolt11 { .. } )
658- } ) ;
659- assert_eq ! ( inbound_payments_b. len( ) , 1 ) ;
656+ if cfg ! ( feature = "legacy_payment_store" ) {
657+ let inbound_payments_b = node_b. list_payments_with_filter ( |p| {
658+ p. direction == PaymentDirection :: Inbound && matches ! ( p. kind, PaymentKind :: Bolt11 { .. } )
659+ } ) ;
660+ assert_eq ! ( inbound_payments_b. len( ) , 1 ) ;
661+ } else {
662+ // Payment inbound are saved in the payment metadata store when they are pending
663+ let inbound_metadata_b = node_b. list_payments_metadata_with_filter ( |p| {
664+ p. direction == PaymentDirection :: Inbound
665+ && matches ! ( p. payment_metadata_detail, PaymentMetadataDetail :: Bolt11 { .. } )
666+ } ) ;
667+ assert_eq ! ( inbound_metadata_b. len( ) , 1 ) ;
668+ let inbound_payments_b = node_b. list_payments_with_filter ( |p| {
669+ p. direction == PaymentDirection :: Inbound && matches ! ( p. kind, PaymentKind :: Bolt11 { .. } )
670+ } ) ;
671+ assert_eq ! ( inbound_payments_b. len( ) , 0 ) ;
672+ }
660673
661674 expect_event ! ( node_a, PaymentSuccessful ) ;
662675 expect_event ! ( node_b, PaymentReceived ) ;
@@ -893,10 +906,22 @@ pub(crate) fn do_channel_full_cycle<E: ElectrumApi>(
893906 node_a. list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Bolt11 { .. } ) ) . len( ) ,
894907 5
895908 ) ;
896- assert_eq ! (
897- node_b. list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Bolt11 { .. } ) ) . len( ) ,
898- 6
899- ) ;
909+ if cfg ! ( feature = "legacy_payment_store" ) {
910+ assert_eq ! (
911+ node_b
912+ . list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Bolt11 { .. } ) )
913+ . len( ) ,
914+ 6
915+ ) ;
916+ } else {
917+ assert_eq ! (
918+ node_b
919+ . list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Bolt11 { .. } ) )
920+ . len( ) ,
921+ 5
922+ ) ;
923+ }
924+
900925 assert_eq ! (
901926 node_a
902927 . list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Spontaneous { .. } ) )
0 commit comments