Skip to content

Commit c1be2c6

Browse files
committed
lightningd: support index/start/end pagination for listhtlcs.
Changelog-Added: JSON-RPC: `listhtlcs` supports `index`, `start` and `end` parameters for pagination support. Signed-off-by: Rusty Russell <[email protected]>
1 parent 1533977 commit c1be2c6

File tree

12 files changed

+857
-658
lines changed

12 files changed

+857
-658
lines changed

.msggen.json

+20-1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@
221221
"SENT_REMOVE_HTLC": 15,
222222
"SENT_REMOVE_REVOCATION": 7
223223
},
224+
"ListhtlcsIndex": {
225+
"created": 0,
226+
"updated": 1
227+
},
224228
"ListinvoicesIndex": {
225229
"created": 0,
226230
"updated": 1
@@ -2570,7 +2574,10 @@
25702574
"ListHtlcs.htlcs[].updated_index": 9
25712575
},
25722576
"ListhtlcsRequest": {
2573-
"ListHtlcs.id": 1
2577+
"ListHtlcs.id": 1,
2578+
"ListHtlcs.index": 2,
2579+
"ListHtlcs.limit": 4,
2580+
"ListHtlcs.start": 3
25742581
},
25752582
"ListhtlcsResponse": {
25762583
"ListHtlcs.htlcs[]": 1
@@ -9620,6 +9627,18 @@
96209627
"added": "pre-v0.10.1",
96219628
"deprecated": null
96229629
},
9630+
"ListHtlcs.index": {
9631+
"added": "v25.05",
9632+
"deprecated": null
9633+
},
9634+
"ListHtlcs.limit": {
9635+
"added": "v25.05",
9636+
"deprecated": null
9637+
},
9638+
"ListHtlcs.start": {
9639+
"added": "v25.05",
9640+
"deprecated": null
9641+
},
96239642
"ListInvoiceRequests": {
96249643
"added": "pre-v0.10.1",
96259644
"deprecated": null

cln-grpc/proto/node.proto

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/model.rs

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/msggen/msggen/schema.json

+43-37
Original file line numberDiff line numberDiff line change
@@ -21534,6 +21534,32 @@
2153421534
"description": [
2153521535
"A short channel id (e.g. 1x2x3) or full 64-byte hex channel id, it will only list htlcs for that channel (which must be known)."
2153621536
]
21537+
},
21538+
"index": {
21539+
"type": "string",
21540+
"added": "v25.05",
21541+
"enum": [
21542+
"created",
21543+
"updated"
21544+
],
21545+
"description": [
21546+
"This controls the ordering of results."
21547+
],
21548+
"default": "`created`"
21549+
},
21550+
"start": {
21551+
"type": "u64",
21552+
"added": "v25.05",
21553+
"description": [
21554+
"If `index` is specified, `start` may be specified to start from that value, which is generally returned from lightning-wait(7)."
21555+
]
21556+
},
21557+
"limit": {
21558+
"type": "u32",
21559+
"added": "v25.05",
21560+
"description": [
21561+
"If `index` is specified, `limit` can be used to specify the maximum number of entries to return."
21562+
]
2153721563
}
2153821564
}
2153921565
},
@@ -21667,6 +21693,8 @@
2166721693
"response": {
2166821694
"htlcs": [
2166921695
{
21696+
"created_index": 1,
21697+
"updated_index": 9,
2167021698
"short_channel_id": "109x1x1",
2167121699
"id": 0,
2167221700
"expiry": 126,
@@ -21676,6 +21704,8 @@
2167621704
"state": "RCVD_REMOVE_ACK_REVOCATION"
2167721705
},
2167821706
{
21707+
"created_index": 2,
21708+
"updated_index": 18,
2167921709
"short_channel_id": "109x1x1",
2168021710
"id": 1,
2168121711
"expiry": 136,
@@ -21685,6 +21715,8 @@
2168521715
"state": "RCVD_REMOVE_ACK_REVOCATION"
2168621716
},
2168721717
{
21718+
"created_index": 3,
21719+
"updated_index": 27,
2168821720
"short_channel_id": "109x1x1",
2168921721
"id": 2,
2169021722
"expiry": 149,
@@ -21694,6 +21726,8 @@
2169421726
"state": "RCVD_REMOVE_ACK_REVOCATION"
2169521727
},
2169621728
{
21729+
"created_index": 4,
21730+
"updated_index": 36,
2169721731
"short_channel_id": "109x1x1",
2169821732
"id": 3,
2169921733
"expiry": 155,
@@ -21703,6 +21737,8 @@
2170321737
"state": "RCVD_REMOVE_ACK_REVOCATION"
2170421738
},
2170521739
{
21740+
"created_index": 5,
21741+
"updated_index": 44,
2170621742
"short_channel_id": "109x1x1",
2170721743
"id": 4,
2170821744
"expiry": 152,
@@ -21718,54 +21754,24 @@
2171821754
"request": {
2171921755
"id": "example:listhtlcs#2",
2172021756
"method": "listhtlcs",
21721-
"params": {}
21757+
"params": {
21758+
"index": "created",
21759+
"start": 4,
21760+
"limit": 1
21761+
}
2172221762
},
2172321763
"response": {
2172421764
"htlcs": [
2172521765
{
21726-
"short_channel_id": "109x1x1",
21727-
"id": 0,
21728-
"expiry": 126,
21729-
"direction": "out",
21730-
"amount_msat": 500000000,
21731-
"payment_hash": "paymenthashdelpay10101010101010101010101010101010101010101010101",
21732-
"state": "RCVD_REMOVE_ACK_REVOCATION"
21733-
},
21734-
{
21735-
"short_channel_id": "109x1x1",
21736-
"id": 1,
21737-
"expiry": 136,
21738-
"direction": "out",
21739-
"amount_msat": 10001,
21740-
"payment_hash": "paymenthashinvl0310031003100310031003100310031003100310031003100",
21741-
"state": "RCVD_REMOVE_ACK_REVOCATION"
21742-
},
21743-
{
21744-
"short_channel_id": "109x1x1",
21745-
"id": 2,
21746-
"expiry": 149,
21747-
"direction": "out",
21748-
"amount_msat": 10001,
21749-
"payment_hash": "paymenthashkey01k101k101k101k101k101k101k101k101k101k101k101k101",
21750-
"state": "RCVD_REMOVE_ACK_REVOCATION"
21751-
},
21752-
{
21766+
"created_index": 4,
21767+
"updated_index": 36,
2175321768
"short_channel_id": "109x1x1",
2175421769
"id": 3,
2175521770
"expiry": 155,
2175621771
"direction": "out",
2175721772
"amount_msat": 10000202,
2175821773
"payment_hash": "paymenthashkey02k201k201k201k201k201k201k201k201k201k201k201k201",
2175921774
"state": "RCVD_REMOVE_ACK_REVOCATION"
21760-
},
21761-
{
21762-
"short_channel_id": "109x1x1",
21763-
"id": 4,
21764-
"expiry": 152,
21765-
"direction": "out",
21766-
"amount_msat": 10001,
21767-
"payment_hash": "paymenthashkey03k301k301k301k301k301k301k301k301k301k301k301k301",
21768-
"state": "RCVD_REMOVE_ACK_REVOCATION"
2176921775
}
2177021776
]
2177121777
}

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

+579-577
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)