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

Function describe_scidd

plugins/xpay/xpay.c:564–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562}
563
564static const char *describe_scidd(struct attempt *attempt, size_t index)
565{
566 struct short_channel_id_dir scidd = attempt->hops[index].scidd;
567 struct payment *payment = attempt->payment;
568
569 assert(index < tal_count(attempt->hops));
570
571 /* Blinded paths? */
572 if (scidd.scid.u64 < tal_count(payment->paths)) {
573 if (tal_count(payment->paths) == 1)
574 return tal_fmt(tmpctx, "the invoice's blinded path (%s)",
575 fmt_short_channel_id_dir(tmpctx, &scidd));
576 return tal_fmt(tmpctx, "the invoice's blinded path %s (%"PRIu64" of %zu)",
577 fmt_short_channel_id_dir(tmpctx, &scidd),
578 scidd.scid.u64 + 1,
579 tal_count(payment->paths));
580 }
581
582 /* Routehint? Often they are a single hop. */
583 if (tal_count(payment->route_hints) == 1
584 && tal_count(payment->route_hints[0]) == 1
585 && short_channel_id_eq(scidd.scid,
586 payment->route_hints[0][0].short_channel_id))
587 return tal_fmt(tmpctx, "the invoice's route hint (%s)",
588 fmt_short_channel_id_dir(tmpctx, &scidd));
589
590 for (size_t i = 0; i < tal_count(payment->route_hints); i++) {
591 for (size_t j = 0; j < tal_count(payment->route_hints[i]); j++) {
592 if (short_channel_id_eq(scidd.scid,
593 payment->route_hints[i][j].short_channel_id)) {
594 return tal_fmt(tmpctx, "%s inside invoice's route hint%s",
595 fmt_short_channel_id_dir(tmpctx, &scidd),
596 tal_count(payment->route_hints) == 1 ? "" : "s");
597 }
598 }
599 }
600
601 /* Just use normal names otherwise (may be public, may be local) */
602 return fmt_short_channel_id_dir(tmpctx, &scidd);
603}
604
605/* How much did previous successes deliver? */
606static struct amount_msat total_delivered(const struct payment *payment)

Callers 1

Calls 2

fmt_short_channel_id_dirFunction · 0.85
short_channel_id_eqFunction · 0.85

Tested by

no test coverage detected