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

Function payment_add_blindedpath

plugins/libplugin-pay.c:1861–1890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1859}
1860
1861static void payment_add_blindedpath(const tal_t *ctx,
1862 struct createonion_hop *hops,
1863 const struct blinded_path *bpath,
1864 struct amount_msat our_amt,
1865 struct amount_msat final_amt,
1866 u32 final_cltv)
1867{
1868 /* It's a bit of a weird API for us, so we convert it back to
1869 * the struct tlv_payload */
1870 u8 **tlvs = blinded_onion_hops(tmpctx, final_amt, final_cltv,
1871 final_amt, bpath);
1872
1873 for (size_t i = 0; i < tal_count(tlvs); i++) {
1874 const u8 *cursor = tlvs[i];
1875 size_t max = tal_bytelen(tlvs[i]);
1876 /* First one has to use real node_id */
1877 if (i == 0) {
1878 assert(bpath->first_node_id.is_pubkey);
1879 node_id_from_pubkey(&hops[i].pubkey,
1880 &bpath->first_node_id.pubkey);
1881 } else {
1882 node_id_from_pubkey(&hops[i].pubkey,
1883 &bpath->path[i]->blinded_node_id);
1884 }
1885
1886 /* Length is prepended, discard that first! */
1887 fromwire_bigsize(&cursor, &max);
1888 hops[i].tlv_payload = fromwire_tlv_payload(ctx, &cursor, &max);
1889 }
1890}
1891
1892static struct command_result *payment_compute_onion_payloads(struct payment *p)
1893{

Callers 1

Calls 4

blinded_onion_hopsFunction · 0.85
tal_bytelenFunction · 0.85
node_id_from_pubkeyFunction · 0.85
fromwire_bigsizeFunction · 0.50

Tested by

no test coverage detected