|
@ -76,8 +76,7 @@ static struct command_result *payment_rpc_failure(struct command *cmd, |
|
|
"Failing a partial payment due to a failed RPC call: %.*s", |
|
|
"Failing a partial payment due to a failed RPC call: %.*s", |
|
|
toks->end - toks->start, buffer + toks->start); |
|
|
toks->end - toks->start, buffer + toks->start); |
|
|
|
|
|
|
|
|
p->step = PAYMENT_STEP_FAILED; |
|
|
payment_fail(p); |
|
|
payment_continue(p); |
|
|
|
|
|
return command_still_pending(cmd); |
|
|
return command_still_pending(cmd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -226,9 +225,8 @@ static struct command_result *payment_getroute_error(struct command *cmd, |
|
|
const jsmntok_t *toks, |
|
|
const jsmntok_t *toks, |
|
|
struct payment *p) |
|
|
struct payment *p) |
|
|
{ |
|
|
{ |
|
|
p->step = PAYMENT_STEP_FAILED; |
|
|
|
|
|
p->route = NULL; |
|
|
p->route = NULL; |
|
|
payment_continue(p); |
|
|
payment_fail(p); |
|
|
|
|
|
|
|
|
/* Let payment_finished_ handle this, so we mark it as pending */ |
|
|
/* Let payment_finished_ handle this, so we mark it as pending */ |
|
|
return command_still_pending(cmd); |
|
|
return command_still_pending(cmd); |
|
@ -492,10 +490,10 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer, |
|
|
|
|
|
|
|
|
if (p->result->state == PAYMENT_COMPLETE) { |
|
|
if (p->result->state == PAYMENT_COMPLETE) { |
|
|
p->step = PAYMENT_STEP_SUCCESS; |
|
|
p->step = PAYMENT_STEP_SUCCESS; |
|
|
goto cont; |
|
|
payment_continue(p); |
|
|
|
|
|
return command_still_pending(cmd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
p->step = PAYMENT_STEP_FAILED; |
|
|
|
|
|
root = payment_root(p); |
|
|
root = payment_root(p); |
|
|
|
|
|
|
|
|
switch (p->result->failcode) { |
|
|
switch (p->result->failcode) { |
|
@ -567,8 +565,7 @@ payment_waitsendpay_finished(struct command *cmd, const char *buffer, |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
cont: |
|
|
payment_fail(p); |
|
|
payment_continue(p); |
|
|
|
|
|
return command_still_pending(cmd); |
|
|
return command_still_pending(cmd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -820,8 +817,6 @@ static void payment_finished(struct payment *p) |
|
|
struct json_stream *ret; |
|
|
struct json_stream *ret; |
|
|
struct command *cmd = p->cmd; |
|
|
struct command *cmd = p->cmd; |
|
|
|
|
|
|
|
|
p->end_time = time_now(); |
|
|
|
|
|
|
|
|
|
|
|
/* Either none of the leaf attempts succeeded yet, or we have a
|
|
|
/* Either none of the leaf attempts succeeded yet, or we have a
|
|
|
* preimage. */ |
|
|
* preimage. */ |
|
|
assert((result.leafstates & PAYMENT_STEP_SUCCESS) == 0 || |
|
|
assert((result.leafstates & PAYMENT_STEP_SUCCESS) == 0 || |
|
@ -996,6 +991,15 @@ void payment_continue(struct payment *p) |
|
|
abort(); |
|
|
abort(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void payment_fail(struct payment *p) |
|
|
|
|
|
{ |
|
|
|
|
|
va_list ap; |
|
|
|
|
|
|
|
|
|
|
|
p->end_time = time_now(); |
|
|
|
|
|
p->step = PAYMENT_STEP_FAILED; |
|
|
|
|
|
payment_continue(p); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void *payment_mod_get_data(const struct payment *p, |
|
|
void *payment_mod_get_data(const struct payment *p, |
|
|
const struct payment_modifier *mod) |
|
|
const struct payment_modifier *mod) |
|
|
{ |
|
|
{ |
|
|