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 @@ -182,6 +182,9 @@ class LibraryTest {
182
182
assert (paymentReceivedEvent is Event .PaymentReceived )
183
183
node2.eventHandled()
184
184
185
+ assert (node1.listPayments().size == 1 )
186
+ assert (node2.listPayments().size == 1 )
187
+
185
188
node2.closeChannel(channelId, nodeId1)
186
189
187
190
val channelClosedEvent1 = node1.waitNextEvent()
@@ -197,7 +200,7 @@ class LibraryTest {
197
200
mine(1u )
198
201
199
202
// Sleep a bit to allow for the block to propagate to esplora
200
- Thread .sleep(3_000 )
203
+ Thread .sleep(5_000 )
201
204
202
205
node1.syncWallets()
203
206
node2.syncWallets()
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ interface Node {
59
59
PaymentDetails? payment([ByRef]PaymentHash payment_hash);
60
60
[Throws=NodeError]
61
61
boolean remove_payment([ByRef]PaymentHash payment_hash);
62
+ sequence<PaymentDetails> list_payments();
62
63
sequence<PeerDetails> list_peers();
63
64
sequence<ChannelDetails> list_channels();
64
65
[Throws=NodeError]
Original file line number Diff line number Diff line change @@ -1623,6 +1623,11 @@ impl Node {
1623
1623
self . payment_store . list_filter ( f)
1624
1624
}
1625
1625
1626
+ /// Retrieves all payments.
1627
+ pub fn list_payments ( & self ) -> Vec < PaymentDetails > {
1628
+ self . payment_store . list_filter ( |_| true )
1629
+ }
1630
+
1626
1631
/// Retrieves a list of known peers.
1627
1632
pub fn list_peers ( & self ) -> Vec < PeerDetails > {
1628
1633
let active_connected_peers: Vec < PublicKey > =
Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ fn channel_full_cycle() {
102
102
let payment_hash = node_a. send_payment ( & invoice) . unwrap ( ) ;
103
103
assert_eq ! ( node_a. send_payment( & invoice) , Err ( Error :: DuplicatePayment ) ) ;
104
104
105
+ assert_eq ! ( node_a. list_payments( ) . first( ) . unwrap( ) . hash, payment_hash) ;
106
+
105
107
let outbound_payments_a =
106
108
node_a. list_payments_with_filter ( |p| p. direction == PaymentDirection :: Outbound ) ;
107
109
assert_eq ! ( outbound_payments_a. len( ) , 1 ) ;
You can’t perform that action at this time.
0 commit comments