File tree Expand file tree Collapse file tree 4 files changed +12
-1
lines changed
kotlin/ldk-node-jvm/lib/src/test/kotlin/org/lightningdevkit/ldknode Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,9 @@ class LibraryTest {
181181 assert (paymentReceivedEvent is Event .PaymentReceived )
182182 node2.eventHandled()
183183
184+ assert (node1.listPayments().size == 1 )
185+ assert (node2.listPayments().size == 1 )
186+
184187 node2.closeChannel(channelId, nodeId1)
185188
186189 val channelClosedEvent1 = node1.waitNextEvent()
@@ -196,7 +199,7 @@ class LibraryTest {
196199 mine(1u )
197200
198201 // Sleep a bit to allow for the block to propagate to esplora
199- Thread .sleep(3_000 )
202+ Thread .sleep(5_000 )
200203
201204 node1.syncWallets()
202205 node2.syncWallets()
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ interface LDKNode {
6767 PaymentDetails? payment([ByRef]PaymentHash payment_hash);
6868 [Throws=NodeError]
6969 boolean remove_payment([ByRef]PaymentHash payment_hash);
70+ sequence<PaymentDetails> list_payments();
7071 sequence<PeerDetails> list_peers();
7172 sequence<ChannelDetails> list_channels();
7273 [Throws=NodeError]
Original file line number Diff line number Diff line change @@ -1728,6 +1728,11 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
17281728 self . payment_store . list_filter ( f)
17291729 }
17301730
1731+ /// Retrieves all payments.
1732+ pub fn list_payments ( & self ) -> Vec < PaymentDetails > {
1733+ self . payment_store . list_filter ( |_| true )
1734+ }
1735+
17311736 /// Retrieves a list of known peers.
17321737 pub fn list_peers ( & self ) -> Vec < PeerDetails > {
17331738 let active_connected_peers: Vec < PublicKey > =
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ fn channel_full_cycle() {
106106 let payment_hash = node_a. send_payment ( & invoice) . unwrap ( ) ;
107107 assert_eq ! ( node_a. send_payment( & invoice) , Err ( Error :: DuplicatePayment ) ) ;
108108
109+ assert_eq ! ( node_a. list_payments( ) . first( ) . unwrap( ) . hash, payment_hash) ;
110+
109111 let outbound_payments_a =
110112 node_a. list_payments_with_filter ( |p| p. direction == PaymentDirection :: Outbound ) ;
111113 assert_eq ! ( outbound_payments_a. len( ) , 1 ) ;
You can’t perform that action at this time.
0 commit comments