BOLT update: catch up ("BOLT 4: rename onionmsg_hop to blinded_path_hop")

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-10-15 09:54:42 +10:30
parent f92c9430fd
commit 76cfff7533
9 changed files with 28 additions and 28 deletions

View File

@@ -39,9 +39,9 @@ json_to_blinded_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok)
if (!hops || hops->size < 1)
return tal_free(rpath);
rpath->path = tal_arr(rpath, struct onionmsg_hop *, hops->size);
rpath->path = tal_arr(rpath, struct blinded_path_hop *, hops->size);
json_for_each_arr(i, t, hops) {
rpath->path[i] = tal(rpath->path, struct onionmsg_hop);
rpath->path[i] = tal(rpath->path, struct blinded_path_hop);
err = json_scan(tmpctx, buffer, t, "{blinded_node_id:%,encrypted_recipient_data:%}",
JSON_SCAN(json_to_pubkey,
&rpath->path[i]->blinded_node_id),

View File

@@ -73,13 +73,13 @@ struct blinded_path *blinded_path_from_encdata_tlvs(const tal_t *ctx,
abort();
sciddir_or_pubkey_from_pubkey(&path->first_node_id, &ids[0]);
path->path = tal_arr(ctx, struct onionmsg_hop *, nhops);
path->path = tal_arr(ctx, struct blinded_path_hop *, nhops);
blinding_iter = first_blinding;
for (size_t i = 0; i < nhops; i++) {
nodeid = get_nodeid(tlvs, ids, i);
path->path[i] = tal(path->path, struct onionmsg_hop);
path->path[i] = tal(path->path, struct blinded_path_hop);
path->path[i]->encrypted_recipient_data
= encrypt_tlv_encrypted_data(path->path[i],
&blinding_iter,
@@ -154,9 +154,9 @@ struct blinded_path *incoming_message_blinded_path(const tal_t *ctx,
}
static void extend_blinded_path(struct blinded_path *bpath,
const struct onionmsg_hop *hop)
const struct blinded_path_hop *hop)
{
struct onionmsg_hop *newhop = tal(bpath->path, struct onionmsg_hop);
struct blinded_path_hop *newhop = tal(bpath->path, struct blinded_path_hop);
newhop->blinded_node_id = hop->blinded_node_id;
newhop->encrypted_recipient_data = tal_dup_talarr(newhop, u8, hop->encrypted_recipient_data);
tal_arr_expand(&bpath->path, newhop);

View File

@@ -232,14 +232,14 @@ int main(int argc, char *argv[])
/* Random blinding secret. */
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[0]->first_path_key));
offer->offer_paths[0]->path = tal_arr(offer->offer_paths[0],
struct onionmsg_hop *,
struct blinded_path_hop *,
2);
offer->offer_paths[0]->path[0] = tal(offer->offer_paths[0]->path,
struct onionmsg_hop);
struct blinded_path_hop);
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[0]->path[0]->blinded_node_id));
offer->offer_paths[0]->path[0]->encrypted_recipient_data = tal_arrz(offer->offer_paths[0]->path[0], u8, 16);
offer->offer_paths[0]->path[1] = tal(offer->offer_paths[0]->path,
struct onionmsg_hop);
struct blinded_path_hop);
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[0]->path[1]->blinded_node_id));
offer->offer_paths[0]->path[1]->encrypted_recipient_data = tal_hexdata(offer->offer_paths[0]->path[1], "1111111111111111", 16);
print_valid_offer(offer, "with blinded path via Bob (0x424242...), path_key 020202...",
@@ -266,14 +266,14 @@ int main(int argc, char *argv[])
/* Random path_key secret. */
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[1]->first_path_key));
offer->offer_paths[1]->path = tal_arr(offer->offer_paths[1],
struct onionmsg_hop *,
struct blinded_path_hop *,
2);
offer->offer_paths[1]->path[0] = tal(offer->offer_paths[1]->path,
struct onionmsg_hop);
struct blinded_path_hop);
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[1]->path[0]->blinded_node_id));
offer->offer_paths[1]->path[0]->encrypted_recipient_data = tal_arrz(offer->offer_paths[1]->path[0], u8, 16);
offer->offer_paths[1]->path[1] = tal(offer->offer_paths[1]->path,
struct onionmsg_hop);
struct blinded_path_hop);
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[1]->path[1]->blinded_node_id));
offer->offer_paths[1]->path[1]->encrypted_recipient_data = tal_hexdata(offer->offer_paths[1]->path[1], "2222222222222222", 16);
print_valid_offer(offer, "... and with second blinded path via 1x2x3 (direction 1), path_key 020202...",
@@ -353,7 +353,7 @@ int main(int argc, char *argv[])
"0A05414C494345"
"100202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020102020202020202020202020202020202020202020202020202020202020202020201"
"1621020202020202020202020202020202020202020202020202020202020202020202",
"Malformed: truncated onionmsg_hop in blinded_path");
"Malformed: truncated blinded_path_hop in blinded_path");
print_malformed_tlv("lno",
"0A05414C494345"
"10030303030303030303030303030303030303030303030303030303030303030303020202020202020202020202020202020202020202020202020202020202020202010202020202020202020202020202020202020202020202020202020202020202020100"
@@ -368,7 +368,7 @@ int main(int argc, char *argv[])
"0A05414C494345"
"10020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202010303030303030303030303030303030303030303030303030303030303030303030100"
"1621020202020202020202020202020202020202020202020202020202020202020202",
"Malformed: bad blinded_node_id in onionmsg_hop");
"Malformed: bad blinded_node_id in blinded_path_hop");
print_malformed_tlv("lno",
"0A05414C494345"

View File

@@ -125,9 +125,9 @@ int main(int argc, char *argv[])
/* FIXME: Test scid as well! */
bpath->first_node_id.is_pubkey = true;
bpath->path = tal_arr(bpath, struct onionmsg_hop *, hops_tok->size);
bpath->path = tal_arr(bpath, struct blinded_path_hop *, hops_tok->size);
json_for_each_arr(i, t, hops_tok) {
bpath->path[i] = tal(bpath->path, struct onionmsg_hop);
bpath->path[i] = tal(bpath->path, struct blinded_path_hop);
assert(json_scan(tmpctx, json, t, "{blinded_node_id:%,encrypted_data:%}",
JSON_SCAN(json_to_pubkey,
&bpath->path[i]->blinded_node_id),