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