mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
plugin: Always set an end_time for payments in a final state
Reported-by: @thestick613 Fixes #3848
This commit is contained in:
@@ -661,6 +661,7 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
|
|||||||
struct route_hop *hop;
|
struct route_hop *hop;
|
||||||
assert(p->route != NULL);
|
assert(p->route != NULL);
|
||||||
|
|
||||||
|
p->end_time = time_now();
|
||||||
p->result = tal_sendpay_result_from_json(p, buffer, toks);
|
p->result = tal_sendpay_result_from_json(p, buffer, toks);
|
||||||
|
|
||||||
if (p->result == NULL) {
|
if (p->result == NULL) {
|
||||||
@@ -677,7 +678,6 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer,
|
|||||||
|
|
||||||
if (p->result->state == PAYMENT_COMPLETE) {
|
if (p->result->state == PAYMENT_COMPLETE) {
|
||||||
payment_set_step(p, PAYMENT_STEP_SUCCESS);
|
payment_set_step(p, PAYMENT_STEP_SUCCESS);
|
||||||
p->end_time = time_now();
|
|
||||||
payment_continue(p);
|
payment_continue(p);
|
||||||
return command_still_pending(cmd);
|
return command_still_pending(cmd);
|
||||||
}
|
}
|
||||||
@@ -1189,6 +1189,10 @@ void payment_set_step(struct payment *p, enum payment_step newstep)
|
|||||||
{
|
{
|
||||||
p->current_modifier = -1;
|
p->current_modifier = -1;
|
||||||
p->step = newstep;
|
p->step = newstep;
|
||||||
|
|
||||||
|
/* Any final state needs an end_time */
|
||||||
|
if (p->step >= PAYMENT_STEP_SPLIT)
|
||||||
|
p->end_time = time_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
void payment_continue(struct payment *p)
|
void payment_continue(struct payment *p)
|
||||||
|
|||||||
Reference in New Issue
Block a user