core-lightning/common/blindedpay.c
Rusty Russell dc18f3cd7b BOLTs: update which renames blinding terminology.
No code changes, just catching up with the BOLT changes which rework our
blinded path terminology (for the better!).

Another patch will sweep the rest of our internal names, this tries only to
make things compile and fix up the BOLT quotes.

1. Inside payload: current_blinding_point -> current_path_key
2. Inside update_add_htlc TLV: blinding_point -> blinded_path
3. Inside blinded_path: blinding -> first_path_key
4. Inside onion_message: blinding -> path_key.
5. Inside encrypted_data_tlv: next_blinding_override -> next_path_key_override

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-16 07:14:32 +10:30

42 lines
1.3 KiB
C

#include "config.h"
#include <assert.h>
#include <common/blindedpay.h>
#include <common/bolt12.h>
#include <common/onion_encode.h>
u8 **blinded_onion_hops(const tal_t *ctx,
struct amount_msat final_amount,
u32 final_cltv,
struct amount_msat total_amount,
const struct blinded_path *path)
{
u8 **onions = tal_arr(ctx, u8 *, tal_count(path->path));
assert(tal_count(onions) > 0);
for (size_t i = 0; i < tal_count(onions); i++) {
bool first = (i == 0);
bool final = (i == tal_count(onions) - 1);
/* BOLT #4:
* - For every node inside a blinded route:
* - MUST include the `encrypted_recipient_data` provided by the
* recipient
* - For the first node in the blinded route:
* - MUST include the `path_key` provided by the
* recipient in `current_path_key`
* - If it is the final node:
* - MUST include `amt_to_forward`, `outgoing_cltv_value` and `total_amount_msat`.
*...
* - MUST NOT include any other tlv field.
*/
onions[i] = onion_blinded_hop(onions,
final ? &final_amount : NULL,
final ? &total_amount : NULL,
final ? &final_cltv : NULL,
path->path[i]->encrypted_recipient_data,
first ? &path->first_path_key : NULL);
}
return onions;
}