File tree 4 files changed +12
-1
lines changed
kotlin/ldk-node-jvm/lib/src/test/kotlin/org/lightningdevkit/ldknode
4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,9 @@ class LibraryTest {
181
181
assert (paymentReceivedEvent is Event .PaymentReceived )
182
182
node2.eventHandled()
183
183
184
+ assert (node1.listPayments().size == 1 )
185
+ assert (node2.listPayments().size == 1 )
186
+
184
187
node2.closeChannel(channelId, nodeId1)
185
188
186
189
val channelClosedEvent1 = node1.waitNextEvent()
@@ -196,7 +199,7 @@ class LibraryTest {
196
199
mine(1u )
197
200
198
201
// Sleep a bit to allow for the block to propagate to esplora
199
- Thread .sleep(3_000 )
202
+ Thread .sleep(5_000 )
200
203
201
204
node1.syncWallets()
202
205
node2.syncWallets()
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ interface LDKNode {
67
67
PaymentDetails? payment([ByRef]PaymentHash payment_hash);
68
68
[Throws=NodeError]
69
69
boolean remove_payment([ByRef]PaymentHash payment_hash);
70
+ sequence<PaymentDetails> list_payments();
70
71
sequence<PeerDetails> list_peers();
71
72
sequence<ChannelDetails> list_channels();
72
73
[Throws=NodeError]
Original file line number Diff line number Diff line change @@ -1728,6 +1728,11 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1728
1728
self . payment_store . list_filter ( f)
1729
1729
}
1730
1730
1731
+ /// Retrieves all payments.
1732
+ pub fn list_payments ( & self ) -> Vec < PaymentDetails > {
1733
+ self . payment_store . list_filter ( |_| true )
1734
+ }
1735
+
1731
1736
/// Retrieves a list of known peers.
1732
1737
pub fn list_peers ( & self ) -> Vec < PeerDetails > {
1733
1738
let active_connected_peers: Vec < PublicKey > =
Original file line number Diff line number Diff line change @@ -106,6 +106,8 @@ fn channel_full_cycle() {
106
106
let payment_hash = node_a. send_payment ( & invoice) . unwrap ( ) ;
107
107
assert_eq ! ( node_a. send_payment( & invoice) , Err ( Error :: DuplicatePayment ) ) ;
108
108
109
+ assert_eq ! ( node_a. list_payments( ) . first( ) . unwrap( ) . hash, payment_hash) ;
110
+
109
111
let outbound_payments_a =
110
112
node_a. list_payments_with_filter ( |p| p. direction == PaymentDirection :: Outbound ) ;
111
113
assert_eq ! ( outbound_payments_a. len( ) , 1 ) ;
You can’t perform that action at this time.
0 commit comments