@@ -14,7 +14,7 @@ use logging::TestLogWriter;
14
14
15
15
use ldk_node:: config:: { Config , ElectrumSyncConfig , EsploraSyncConfig } ;
16
16
use ldk_node:: io:: sqlite_store:: SqliteStore ;
17
- use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentStatus } ;
17
+ use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentMetadataDetail , PaymentStatus } ;
18
18
use ldk_node:: {
19
19
Builder , CustomTlvRecord , Event , LightningBalance , Node , NodeError , PendingSweepBalance ,
20
20
} ;
@@ -653,10 +653,23 @@ pub(crate) fn do_channel_full_cycle<E: ElectrumApi>(
653
653
} ) ;
654
654
assert_eq ! ( outbound_payments_b. len( ) , 0 ) ;
655
655
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
+ }
660
673
661
674
expect_event ! ( node_a, PaymentSuccessful ) ;
662
675
expect_event ! ( node_b, PaymentReceived ) ;
@@ -893,10 +906,22 @@ pub(crate) fn do_channel_full_cycle<E: ElectrumApi>(
893
906
node_a. list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Bolt11 { .. } ) ) . len( ) ,
894
907
5
895
908
) ;
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
+
900
925
assert_eq ! (
901
926
node_a
902
927
. list_payments_with_filter( |p| matches!( p. kind, PaymentKind :: Spontaneous { .. } ) )
0 commit comments