MCPcopy Create free account
hub / github.com/ElementsProject/lightning / payment_abort

Function payment_abort

plugins/libplugin-pay.c:2396–2422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2394}
2395
2396struct command_result *payment_abort(struct payment *p, enum jsonrpc_errcode code, const char *fmt, ...) {
2397 va_list ap;
2398 struct payment *root = payment_root(p);
2399 payment_set_step(p, PAYMENT_STEP_FAILED);
2400 p->end_time = clock_time();
2401
2402 /* We can fail twice, it seems. */
2403 tal_free(p->failreason);
2404 va_start(ap, fmt);
2405 p->failreason = tal_vfmt(p, fmt, ap);
2406 va_end(ap);
2407
2408 root->abort = true;
2409
2410 /* Only set the abort error if it's not yet set, otherwise we
2411 * might end up clobbering the earliest and decisive failure
2412 * with less relevant ones. */
2413 if (root->aborterror == NULL)
2414 root->aborterror = tal_dup_talarr(root, char, p->failreason);
2415
2416 paymod_log(p, LOG_INFORM, "%s", p->failreason);
2417
2418 /* Do not use payment_continue, because that'd continue
2419 * applying the modifiers before calling
2420 * payment_finished(). */
2421 return payment_finished(p);
2422}
2423
2424struct command_result *payment_fail(struct payment *p, const char *fmt, ...)
2425{

Callers 4

keysend_cbFunction · 0.85
route_exclusions_step_cbFunction · 0.85

Calls 6

payment_rootFunction · 0.85
payment_set_stepFunction · 0.85
clock_timeFunction · 0.85
tal_freeFunction · 0.85
paymod_logFunction · 0.85
payment_finishedFunction · 0.85

Tested by

no test coverage detected