| 1843 | } |
| 1844 | |
| 1845 | static 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 | |
| 1876 | static struct command_result *payment_compute_onion_payloads(struct payment *p) |
| 1877 | { |
no test coverage detected