Skip to content

Commit 385b6a0

Browse files
committed
fixup! add listing options to listpays
1 parent eb84e43 commit 385b6a0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plugins/pay.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ static void add_new_entry(struct json_stream *ret,
419419
json_add_u64(ret, "number_of_parts",
420420
pm->num_nonfailed_parts);
421421

422-
if(pm->created_index)
423-
json_add_u64(ret, "created_index", pm->created_index);
422+
json_add_u64(ret, "created_index", pm->created_index);
424423

425424
if(pm->updated_index)
426425
json_add_u64(ret, "updated_index", pm->updated_index);
@@ -527,6 +526,15 @@ static struct command_result *listsendpays_done(struct command *cmd,
527526
pm->invstring = tal_steal(pm, invstr);
528527
if (!pm->description)
529528
pm->description = json_get_member(buf, t, "description");
529+
/* What's the "created_index" of the merged record?
530+
* We take the *lowest*, since that will never change
531+
* (unless they delete payments!). */
532+
if (created_index < pm->created_index)
533+
pm->created_index = created_index;
534+
/* On the other hand, we take the *highest*
535+
* updated_index, so we see any changes. */
536+
if (updated_index > pm->updated_index)
537+
pm->updated_index = updated_index;
530538
}
531539

532540
status = json_get_member(buf, t, "status");

tests/test_pay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6267,7 +6267,7 @@ def test_injectpaymentonion_selfpay(node_factory, executor):
62676267
'amount_sent_msat': 1000,
62686268
'number_of_parts': 2,
62696269
'created_index': 2,
6270-
'updated_index': 2}
6270+
'updated_index': 3}
62716271

62726272
# Test self-pay with MPP from non-selfpay.
62736273
inv6 = l2.rpc.invoice(3000, "test_injectpaymentonion6", "test_injectpaymentonion6")

0 commit comments

Comments
 (0)