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

Function payment_give_up

plugins/xpay/xpay.c:506–537  ·  view source on GitHub ↗

We won't try sending any more. Usually this means we return this * failure to the user, but see below. */

Source from the content-addressed store, hash-verified

504/* We won't try sending any more. Usually this means we return this
505 * failure to the user, but see below. */
506static void payment_give_up(struct command *aux_cmd,
507 struct payment *payment,
508 enum jsonrpc_errcode code,
509 const char *fmt,
510 ...)
511{
512 va_list args;
513 const char *msg;
514
515 va_start(args, fmt);
516 msg = tal_vfmt(tmpctx, fmt, args);
517 va_end(args);
518
519 /* Only fail once */
520 if (payment->cmd && should_finish_command(payment)) {
521 const struct preimage *preimage;
522
523 /* Corner case: in slow_mode, an earlier one could have
524 * theoretically succeeded. */
525 preimage = any_attempts_succeeded(payment);
526 if (preimage)
527 payment_succeeded(payment, preimage);
528 else {
529 was_pending(command_fail(payment->cmd, code, "%s", msg));
530 payment->cmd = NULL;
531 }
532 }
533
534 /* If no commands outstanding, we can now clean up */
535 if (tal_count(payment->requests) == 0)
536 cleanup(aux_cmd, payment);
537}
538
539static void add_result_summary(struct attempt *attempt,
540 enum log_level level,

Callers 6

do_injectFunction · 0.85
reserve_done_errFunction · 0.85
getroutes_doneFunction · 0.85
getroutes_done_errFunction · 0.85
waitblockheight_failedFunction · 0.85

Calls 6

should_finish_commandFunction · 0.85
any_attempts_succeededFunction · 0.85
cleanupFunction · 0.85
payment_succeededFunction · 0.70
was_pendingFunction · 0.70
command_failFunction · 0.50

Tested by

no test coverage detected