BOLT #12: * - if it is connected only by private channels: * - MUST include `offer_paths` containing one or more paths to the node * from publicly reachable nodes. */
| 67 | * from publicly reachable nodes. |
| 68 | */ |
| 69 | bool we_want_blinded_path(struct plugin *plugin, |
| 70 | const struct pubkey *fronting_nodes, |
| 71 | bool for_payment) |
| 72 | { |
| 73 | const struct offers_data *od = get_offers_data(plugin); |
| 74 | struct node_id local_nodeid; |
| 75 | const struct gossmap_node *node; |
| 76 | const u8 *nannounce; |
| 77 | const struct gossmap *gossmap = get_gossmap(plugin); |
| 78 | struct node_id our_id; |
| 79 | secp256k1_ecdsa_signature signature; |
| 80 | u32 timestamp; |
| 81 | u8 *addresses, *features; |
| 82 | u8 rgb_color[3], alias[32]; |
| 83 | struct tlv_node_ann_tlvs *na_tlvs; |
| 84 | |
| 85 | /* If we're fronting, we always want a blinded path */ |
| 86 | if (fronting_nodes) |
| 87 | return true; |
| 88 | |
| 89 | node_id_from_pubkey(&local_nodeid, &od->id); |
| 90 | |
| 91 | node = gossmap_find_node(gossmap, &local_nodeid); |
| 92 | if (!node) |
| 93 | return true; |
| 94 | |
| 95 | /* Matt Corallo also suggests we do this (for now) if we don't |
| 96 | * advertize an address to connect to, so they can fetch the |
| 97 | * invoice for the offer, or send the invoice for the invoicerequest. |
| 98 | * For actual payments they can use any route. */ |
| 99 | if (for_payment) |
| 100 | return false; |
| 101 | |
| 102 | /* We expect to know our own node announcements, but just in case. */ |
| 103 | nannounce = gossmap_node_get_announce(tmpctx, gossmap, node); |
| 104 | if (!nannounce) |
| 105 | return true; |
| 106 | |
| 107 | if (!fromwire_node_announcement(tmpctx, nannounce, |
| 108 | &signature, &features, |
| 109 | ×tamp, |
| 110 | &our_id, rgb_color, alias, |
| 111 | &addresses, |
| 112 | &na_tlvs)) |
| 113 | return true; |
| 114 | |
| 115 | return tal_count(fromwire_wireaddr_array(tmpctx, addresses)) == 0; |
| 116 | } |
| 117 | |
| 118 | static struct command_result *finished(struct command *cmd, |
| 119 | const char *method, |
no test coverage detected