From 76cfff75334aa6fb7a06cf7dffd129bd90b3050f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 15 Oct 2024 09:54:42 +1030 Subject: [PATCH] BOLT update: catch up ("BOLT 4: rename `onionmsg_hop` to `blinded_path_hop`") Signed-off-by: Rusty Russell --- Makefile | 2 +- common/json_blinded_path.c | 4 ++-- common/onion_message.c | 8 ++++---- common/test/run-bolt12-encode-test.c | 16 ++++++++-------- common/test/run-route_blinding_onion_test.c | 4 ++-- devtools/bolt12-cli.c | 2 +- lightningd/invoice.c | 4 ++-- plugins/offers.c | 6 +++--- wire/onion_wire.csv | 10 +++++----- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index c62e6de1f..ad18258e1 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/common/json_blinded_path.c b/common/json_blinded_path.c index d97caac66..78ef625e6 100644 --- a/common/json_blinded_path.c +++ b/common/json_blinded_path.c @@ -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), diff --git a/common/onion_message.c b/common/onion_message.c index ee7eb8334..c781866ee 100644 --- a/common/onion_message.c +++ b/common/onion_message.c @@ -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); diff --git a/common/test/run-bolt12-encode-test.c b/common/test/run-bolt12-encode-test.c index 9ec552ddd..c471dd386 100644 --- a/common/test/run-bolt12-encode-test.c +++ b/common/test/run-bolt12-encode-test.c @@ -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" diff --git a/common/test/run-route_blinding_onion_test.c b/common/test/run-route_blinding_onion_test.c index 84b291c2c..4435ee576 100644 --- a/common/test/run-route_blinding_onion_test.c +++ b/common/test/run-route_blinding_onion_test.c @@ -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), diff --git a/devtools/bolt12-cli.c b/devtools/bolt12-cli.c index d6feea32e..2dc10be72 100644 --- a/devtools/bolt12-cli.c +++ b/devtools/bolt12-cli.c @@ -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), diff --git a/lightningd/invoice.c b/lightningd/invoice.c index d287c89ee..265dc2122 100644 --- a/lightningd/invoice.c +++ b/lightningd/invoice.c @@ -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! */ diff --git a/plugins/offers.c b/plugins/offers.c index bb92f2a28..21b50943b 100644 --- a/plugins/offers.c +++ b/plugins/offers.c @@ -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); @@ -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); diff --git a/wire/onion_wire.csv b/wire/onion_wire.csv index e37f181d2..307940000 100644 --- a/wire/onion_wire.csv +++ b/wire/onion_wire.csv @@ -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