We are the entry point, so the next hop could actually be an scid alias, * so we can't just use gossmap. */
| 707 | /* We are the entry point, so the next hop could actually be an scid alias, |
| 708 | * so we can't just use gossmap. */ |
| 709 | static struct command_result *listpeerchannels_done(struct command *cmd, |
| 710 | const char *method, |
| 711 | const char *buf, |
| 712 | const jsmntok_t *result, |
| 713 | struct payment *p) |
| 714 | { |
| 715 | const jsmntok_t *arr, *t; |
| 716 | size_t i; |
| 717 | |
| 718 | assert(!p->blindedpath->first_node_id.is_pubkey); |
| 719 | arr = json_get_member(buf, result, "channels"); |
| 720 | json_for_each_arr(i, t, arr) { |
| 721 | const jsmntok_t *alias, *local_alias, *scid; |
| 722 | struct pubkey id; |
| 723 | |
| 724 | alias = json_get_member(buf, t, "alias"); |
| 725 | if (alias) |
| 726 | local_alias = json_get_member(buf, alias, "local"); |
| 727 | else |
| 728 | local_alias = NULL; |
| 729 | |
| 730 | scid = json_get_member(buf, t, "short_channel_id"); |
| 731 | if (!scidtok_eq(buf, scid, p->blindedpath->first_node_id.scidd.scid) |
| 732 | && !scidtok_eq(buf, local_alias, p->blindedpath->first_node_id.scidd.scid)) { |
| 733 | continue; |
| 734 | } |
| 735 | |
| 736 | if (!json_to_pubkey(buf, json_get_member(buf, t, "peer_id"), &id)) |
| 737 | plugin_err(cmd->plugin, "listpeerchannels no peer_id: %.*s", |
| 738 | json_tok_full_len(result), |
| 739 | json_tok_full(buf, result)); |
| 740 | |
| 741 | plugin_log(cmd->plugin, LOG_DBG, |
| 742 | "Mapped decrypted next hop from %s -> %s", |
| 743 | fmt_short_channel_id(tmpctx, p->blindedpath->first_node_id.scidd.scid), |
| 744 | fmt_pubkey(tmpctx, &id)); |
| 745 | sciddir_or_pubkey_from_pubkey(&p->blindedpath->first_node_id, &id); |
| 746 | /* Fix up our destination */ |
| 747 | node_id_from_pubkey(p->route_destination, &p->blindedpath->first_node_id.pubkey); |
| 748 | return start_payment(cmd, p); |
| 749 | } |
| 750 | |
| 751 | return command_fail(cmd, PAY_UNPARSEABLE_ONION, |
| 752 | "Invalid next short_channel_id %s for second hop of onion", |
| 753 | fmt_short_channel_id(tmpctx, |
| 754 | p->blindedpath->first_node_id.scidd.scid)); |
| 755 | } |
| 756 | |
| 757 | static struct command_result * |
| 758 | decrypt_done(struct command *cmd, |
nothing calls this directly
no test coverage detected