Skip to content

Commit

Permalink
BOLT update: catch up ("BOLT 4: rename onionmsg_hop to `blinded_pat…
Browse files Browse the repository at this point in the history
…h_hop`")

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Oct 15, 2024
1 parent f92c943 commit 76cfff7
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../bolts/
DEFAULT_BOLTVERSION := 9c15a5c09297d22767656a27e253fbb570653fa9
DEFAULT_BOLTVERSION := 6654c5711a2765f48a31389064c04a153670d73b
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

Expand Down
4 changes: 2 additions & 2 deletions common/json_blinded_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 4 additions & 4 deletions common/onion_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions common/test/run-bolt12-encode-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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...",
Expand All @@ -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...",
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions common/test/run-route_blinding_onion_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion devtools/bolt12-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static bool print_blindedpaths(const char *fieldname,
size_t bp_idx = 0;

for (size_t i = 0; i < tal_count(paths); i++) {
struct onionmsg_hop **p = paths[i]->path;
struct blinded_path_hop **p = paths[i]->path;
printf("%s %zu/%zu: first_path_key %s ",
fieldname,
i, tal_count(paths),
Expand Down
4 changes: 2 additions & 2 deletions lightningd/invoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,8 +1621,8 @@ static void add_stub_blindedpath(const tal_t *ctx,
randombytes_buf(&path_key, sizeof(path_key));
if (!pubkey_from_privkey(&path_key, &path->first_path_key))
abort();
path->path = tal_arr(path, struct onionmsg_hop *, 1);
path->path[0] = tal(path->path, struct onionmsg_hop);
path->path = tal_arr(path, struct blinded_path_hop *, 1);
path->path[0] = tal(path->path, struct blinded_path_hop);

/* A message in a bottle to ourselves: match it with
* the invoice: we assume the payment_hash is unique! */
Expand Down
6 changes: 3 additions & 3 deletions plugins/offers.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ static struct blinded_path *blinded_path_dup(const tal_t *ctx,
{
struct blinded_path *bp = tal(ctx, struct blinded_path);
*bp = *old;
bp->path = tal_arr(bp, struct onionmsg_hop *, tal_count(old->path));
bp->path = tal_arr(bp, struct blinded_path_hop *, tal_count(old->path));
for (size_t i = 0; i < tal_count(bp->path); i++) {
bp->path[i] = tal(bp->path, struct onionmsg_hop);
bp->path[i] = tal(bp->path, struct blinded_path_hop);
bp->path[i]->blinded_node_id = old->path[i]->blinded_node_id;
bp->path[i]->encrypted_recipient_data = tal_dup_talarr(bp->path[i], u8,
old->path[i]->encrypted_recipient_data);
Expand Down Expand Up @@ -504,7 +504,7 @@ static void json_add_chains(struct json_stream *js,

static void json_add_onionmsg_path(struct json_stream *js,
const char *fieldname,
const struct onionmsg_hop *hop)
const struct blinded_path_hop *hop)
{
json_object_start(js, fieldname);
json_add_pubkey(js, "blinded_node_id", &hop->blinded_node_id);
Expand Down
10 changes: 5 additions & 5 deletions wire/onion_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ subtype,blinded_path
subtypedata,blinded_path,first_node_id,sciddir_or_pubkey,
subtypedata,blinded_path,first_path_key,point,
subtypedata,blinded_path,num_hops,byte,
subtypedata,blinded_path,path,onionmsg_hop,num_hops
subtype,onionmsg_hop
subtypedata,onionmsg_hop,blinded_node_id,point,
subtypedata,onionmsg_hop,enclen,u16,
subtypedata,onionmsg_hop,encrypted_recipient_data,byte,enclen
subtypedata,blinded_path,path,blinded_path_hop,num_hops
subtype,blinded_path_hop
subtypedata,blinded_path_hop,blinded_node_id,point,
subtypedata,blinded_path_hop,enclen,u16,
subtypedata,blinded_path_hop,encrypted_recipient_data,byte,enclen
tlvtype,encrypted_data_tlv,padding,1
tlvdata,encrypted_data_tlv,padding,padding,byte,...
tlvtype,encrypted_data_tlv,short_channel_id,2
Expand Down

0 comments on commit 76cfff7

Please sign in to comment.