Skip to content

Commit c984376

Browse files
committed
plugin: Always set an end_time for payments in a final state
Reported-by: @thestick613 Fixes #3848
1 parent 65ca634 commit c984376

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/libplugin-pay.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
661661
struct route_hop *hop;
662662
assert(p->route != NULL);
663663

664+
p->end_time = time_now();
664665
p->result = tal_sendpay_result_from_json(p, buffer, toks);
665666

666667
if (p->result == NULL) {
@@ -677,7 +678,6 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
677678

678679
if (p->result->state == PAYMENT_COMPLETE) {
679680
payment_set_step(p, PAYMENT_STEP_SUCCESS);
680-
p->end_time = time_now();
681681
payment_continue(p);
682682
return command_still_pending(cmd);
683683
}
@@ -1189,6 +1189,10 @@ void payment_set_step(struct payment *p, enum payment_step newstep)
11891189
{
11901190
p->current_modifier = -1;
11911191
p->step = newstep;
1192+
1193+
/* Any final state needs an end_time */
1194+
if (p->step >= PAYMENT_STEP_SPLIT)
1195+
p->end_time = time_now();
11921196
}
11931197

11941198
void payment_continue(struct payment *p)

0 commit comments

Comments
 (0)