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

Function payment_add_blindedpath

plugins/libplugin-pay.c:1845–1874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1843}
1844
1845static void payment_add_blindedpath(const tal_t *ctx,
1846 struct createonion_hop *hops,
1847 const struct blinded_path *bpath,
1848 struct amount_msat our_amt,
1849 struct amount_msat final_amt,
1850 u32 final_cltv)
1851{
1852 /* It's a bit of a weird API for us, so we convert it back to
1853 * the struct tlv_payload */
1854 u8 **tlvs = blinded_onion_hops(tmpctx, final_amt, final_cltv,
1855 final_amt, bpath);
1856
1857 for (size_t i = 0; i < tal_count(tlvs); i++) {
1858 const u8 *cursor = tlvs[i];
1859 size_t max = tal_bytelen(tlvs[i]);
1860 /* First one has to use real node_id */
1861 if (i == 0) {
1862 assert(bpath->first_node_id.is_pubkey);
1863 node_id_from_pubkey(&hops[i].pubkey,
1864 &bpath->first_node_id.pubkey);
1865 } else {
1866 node_id_from_pubkey(&hops[i].pubkey,
1867 &bpath->path[i]->blinded_node_id);
1868 }
1869
1870 /* Length is prepended, discard that first! */
1871 fromwire_bigsize(&cursor, &max);
1872 hops[i].tlv_payload = fromwire_tlv_payload(ctx, &cursor, &max);
1873 }
1874}
1875
1876static struct command_result *payment_compute_onion_payloads(struct payment *p)
1877{

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