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

Function tell_waiters_failed

lightningd/pay.c:305–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305static void tell_waiters_failed(struct lightningd *ld,
306 const struct wallet_payment *payment,
307 enum jsonrpc_errcode pay_errcode,
308 const struct onionreply *onionreply,
309 const struct routing_failure *fail,
310 const char *details)
311{
312 struct waitsendpay_command *pc;
313 struct waitsendpay_command *next;
314 const char *errmsg =
315 sendpay_errmsg_fmt(tmpctx, pay_errcode, fail, details);
316
317 /* Careful: ->fail deletes cmd, which may own the payment_hash our
318 * caller was given (injectpaymentonion's selfpay), so match on
319 * payment's own copy. */
320 list_for_each_safe(&ld->waitsendpay_commands, pc, next, list) {
321 if (!sha256_eq(&payment->payment_hash, &pc->payment_hash))
322 continue;
323 if (payment->partid != pc->partid)
324 continue;
325 if (payment->groupid != pc->groupid)
326 continue;
327
328 pc->fail(pc->cmd, payment, pay_errcode, onionreply, fail, errmsg, pc->arg);
329 }
330
331 notify_sendpay_failure(ld,
332 payment,
333 pay_errcode,
334 onionreply,
335 fail,
336 errmsg);
337}
338
339static void tell_waiters_success(struct lightningd *ld,
340 struct wallet_payment *payment)

Callers 2

payment_failedFunction · 0.85
self_paymentFunction · 0.85

Calls 3

sendpay_errmsg_fmtFunction · 0.85
failMethod · 0.80
notify_sendpay_failureFunction · 0.70

Tested by

no test coverage detected