| 253 | } |
| 254 | |
| 255 | static void sphinx_append_blinded_path(const tal_t *ctx, |
| 256 | struct sphinx_path *sp, |
| 257 | const struct blinded_path *blinded_path, |
| 258 | const struct amount_msat deliver, |
| 259 | const struct amount_msat total, |
| 260 | const u32 final_cltv) |
| 261 | { |
| 262 | const size_t pathlen = tal_count(blinded_path->path); |
| 263 | bool ret; |
| 264 | |
| 265 | for (size_t i = 0; i < pathlen; i++) { |
| 266 | bool first = (i == 0); |
| 267 | bool final = (i == pathlen - 1); |
| 268 | |
| 269 | const struct blinded_path_hop *bhop = blinded_path->path[i]; |
| 270 | const u8 *payload = onion_blinded_hop( |
| 271 | ctx, final ? &deliver : NULL, final ? &total : NULL, |
| 272 | final ? &final_cltv : NULL, bhop->encrypted_recipient_data, |
| 273 | first ? &blinded_path->first_path_key : NULL); |
| 274 | // FIXME: better handle error here |
| 275 | ret = sphinx_add_hop_has_length( |
| 276 | sp, |
| 277 | first ? &blinded_path->first_node_id.pubkey |
| 278 | : &bhop->blinded_node_id, |
| 279 | take(payload)); |
| 280 | assert(ret); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | static void sphinx_append_final_hop(const tal_t *ctx, |
| 285 | struct sphinx_path *sp, |
no test coverage detected