diff --git a/bitcoin/pubkey.c b/bitcoin/pubkey.c index 0b731a614..2e26259ec 100644 --- a/bitcoin/pubkey.c +++ b/bitcoin/pubkey.c @@ -125,7 +125,7 @@ void towire_pubkey(u8 **pptr, const struct pubkey *pubkey) towire(pptr, output, outputlen); } -void fromwire_pubkey32(const u8 **cursor, size_t *max, struct pubkey32 *pubkey32) +void fromwire_point32(const u8 **cursor, size_t *max, struct point32 *point32) { u8 raw[32]; @@ -133,28 +133,28 @@ void fromwire_pubkey32(const u8 **cursor, size_t *max, struct pubkey32 *pubkey32 return; if (secp256k1_xonly_pubkey_parse(secp256k1_ctx, - &pubkey32->pubkey, + &point32->pubkey, raw) != 1) { SUPERVERBOSE("not a valid point"); fromwire_fail(cursor, max); } } -void towire_pubkey32(u8 **pptr, const struct pubkey32 *pubkey32) +void towire_point32(u8 **pptr, const struct point32 *point32) { u8 output[32]; secp256k1_xonly_pubkey_serialize(secp256k1_ctx, output, - &pubkey32->pubkey); + &point32->pubkey); towire(pptr, output, sizeof(output)); } -char *pubkey32_to_hexstr(const tal_t *ctx, const struct pubkey32 *pubkey32) +char *point32_to_hexstr(const tal_t *ctx, const struct point32 *point32) { u8 output[32]; secp256k1_xonly_pubkey_serialize(secp256k1_ctx, output, - &pubkey32->pubkey); + &point32->pubkey); return tal_hexstr(ctx, output, sizeof(output)); } -REGISTER_TYPE_TO_STRING(pubkey32, pubkey32_to_hexstr); +REGISTER_TYPE_TO_STRING(point32, point32_to_hexstr); diff --git a/bitcoin/pubkey.h b/bitcoin/pubkey.h index b24cc2aa2..4474c91c9 100644 --- a/bitcoin/pubkey.h +++ b/bitcoin/pubkey.h @@ -19,12 +19,12 @@ struct pubkey { /* Define pubkey_eq (no padding) */ STRUCTEQ_DEF(pubkey, 0, pubkey.data); -struct pubkey32 { +struct point32 { /* Unpacked pubkey (as used by libsecp256k1 internally) */ secp256k1_xonly_pubkey pubkey; }; /* Define pubkey_eq (no padding) */ -STRUCTEQ_DEF(pubkey32, 0, pubkey.data); +STRUCTEQ_DEF(point32, 0, pubkey.data); /* Convert from hex string of DER (scriptPubKey from validateaddress) */ bool pubkey_from_hexstr(const char *derstr, size_t derlen, struct pubkey *key); @@ -66,9 +66,14 @@ void pubkey_to_hash160(const struct pubkey *pk, struct ripemd160 *hash); void towire_pubkey(u8 **pptr, const struct pubkey *pubkey); void fromwire_pubkey(const u8 **cursor, size_t *max, struct pubkey *pubkey); -/* marshal/unmarshal functions */ -void towire_pubkey32(u8 **pptr, const struct pubkey32 *pubkey); -void fromwire_pubkey32(const u8 **cursor, size_t *max, struct pubkey32 *pubkey); +/* FIXME: Old spec uses pubkey32 */ +#define pubkey32 point32 +#define towire_pubkey32 towire_point32 +#define fromwire_pubkey32 fromwire_point32 -char *pubkey32_to_hexstr(const tal_t *ctx, const struct pubkey32 *pubkey32); +/* marshal/unmarshal functions */ +void towire_point32(u8 **pptr, const struct point32 *pubkey); +void fromwire_point32(const u8 **cursor, size_t *max, struct point32 *pubkey); + +char *point32_to_hexstr(const tal_t *ctx, const struct point32 *point32); #endif /* LIGHTNING_BITCOIN_PUBKEY_H */ diff --git a/common/bolt12.c b/common/bolt12.c index 9da10c473..1910d26e9 100644 --- a/common/bolt12.c +++ b/common/bolt12.c @@ -70,7 +70,7 @@ static char *check_features_and_chain(const tal_t *ctx, bool bolt12_check_signature(const struct tlv_field *fields, const char *messagename, const char *fieldname, - const struct pubkey32 *key, + const struct point32 *key, const struct bip340sig *sig) { struct sha256 m, shash; @@ -87,7 +87,7 @@ static char *check_signature(const tal_t *ctx, const struct tlv_field *fields, const char *messagename, const char *fieldname, - const struct pubkey32 *node_id, + const struct point32 *node_id, const struct bip340sig *sig) { if (!node_id) diff --git a/common/bolt12.h b/common/bolt12.h index 71d17ce89..c460f4eac 100644 --- a/common/bolt12.h +++ b/common/bolt12.h @@ -96,7 +96,7 @@ struct tlv_invoice *invoice_decode_nosig(const tal_t *ctx, bool bolt12_check_signature(const struct tlv_field *fields, const char *messagename, const char *fieldname, - const struct pubkey32 *key, + const struct point32 *key, const struct bip340sig *sig); /* Given a tal_arr of chains, does it contain this chain? */ diff --git a/common/bolt12_merkle.c b/common/bolt12_merkle.c index c96dfdc8c..2865b7e55 100644 --- a/common/bolt12_merkle.c +++ b/common/bolt12_merkle.c @@ -220,7 +220,7 @@ void sighash_from_merkle(const char *messagename, /* We use the SHA(pubkey | publictweak); so reader cannot figure out the * tweak and derive the base key */ -void payer_key_tweak(const struct pubkey32 *bolt12, +void payer_key_tweak(const struct point32 *bolt12, const u8 *publictweak, size_t publictweaklen, struct sha256 *tweak) { diff --git a/common/bolt12_merkle.h b/common/bolt12_merkle.h index af8b4bad3..08ae9fc20 100644 --- a/common/bolt12_merkle.h +++ b/common/bolt12_merkle.h @@ -25,7 +25,7 @@ void sighash_from_merkle(const char *messagename, /** * payer_key_tweak - get the actual tweak to use for a payer_key */ -void payer_key_tweak(const struct pubkey32 *bolt12, +void payer_key_tweak(const struct point32 *bolt12, const u8 *publictweak, size_t publictweaklen, struct sha256 *tweak); diff --git a/common/gossmap.c b/common/gossmap.c index 67aafd516..ff27b974b 100644 --- a/common/gossmap.c +++ b/common/gossmap.c @@ -1255,13 +1255,13 @@ int gossmap_node_get_feature(const struct gossmap *map, /* There are two 33-byte pubkeys possible: choose the one which appears * in the graph (otherwise payment will fail anyway). */ void gossmap_guess_node_id(const struct gossmap *map, - const struct pubkey32 *pubkey32, + const struct point32 *point32, struct node_id *id) { id->k[0] = SECP256K1_TAG_PUBKEY_EVEN; secp256k1_xonly_pubkey_serialize(secp256k1_ctx, id->k + 1, - &pubkey32->pubkey); + &point32->pubkey); /* If we don't find this, let's assume it's odd. */ if (!gossmap_find_node(map, id)) diff --git a/common/gossmap.h b/common/gossmap.h index 92880f098..728dc8385 100644 --- a/common/gossmap.h +++ b/common/gossmap.h @@ -8,7 +8,7 @@ #include struct node_id; -struct pubkey32; +struct point32; struct gossmap_node { /* Offset in memory map for node_announce, or 0. */ @@ -202,7 +202,7 @@ struct gossmap_chan *gossmap_next_chan(const struct gossmap *map, /* Each x-only pubkey has two possible values: we can figure out which by * examining the gossmap. */ void gossmap_guess_node_id(const struct gossmap *map, - const struct pubkey32 *pubkey32, + const struct point32 *point32, struct node_id *id); #endif /* LIGHTNING_COMMON_GOSSMAP_H */ diff --git a/common/json_helpers.c b/common/json_helpers.c index 6de486067..0629b03e7 100644 --- a/common/json_helpers.c +++ b/common/json_helpers.c @@ -201,9 +201,9 @@ void json_add_pubkey(struct json_stream *response, json_add_hex(response, fieldname, der, sizeof(der)); } -void json_add_pubkey32(struct json_stream *response, - const char *fieldname, - const struct pubkey32 *key) +void json_add_point32(struct json_stream *response, + const char *fieldname, + const struct point32 *key) { u8 output[32]; diff --git a/common/json_helpers.h b/common/json_helpers.h index 7dd4b7ba1..e3001a0e7 100644 --- a/common/json_helpers.h +++ b/common/json_helpers.h @@ -14,7 +14,7 @@ struct lease_rates; struct node_id; struct preimage; struct pubkey; -struct pubkey32; +struct point32; struct secret; struct short_channel_id; struct short_channel_id_dir; @@ -91,9 +91,9 @@ void json_add_pubkey(struct json_stream *response, const struct pubkey *key); /* '"fieldname" : "89abcdef..."' or "89abcdef..." if fieldname is NULL */ -void json_add_pubkey32(struct json_stream *response, +void json_add_point32(struct json_stream *response, const char *fieldname, - const struct pubkey32 *key); + const struct point32 *key); /* '"fieldname" : "89abcdef..."' or "89abcdef..." if fieldname is NULL */ void json_add_bip340sig(struct json_stream *response, diff --git a/common/node_id.c b/common/node_id.c index 4444ec9be..d130dcff4 100644 --- a/common/node_id.c +++ b/common/node_id.c @@ -26,7 +26,7 @@ bool pubkey_from_node_id(struct pubkey *key, const struct node_id *id) } WARN_UNUSED_RESULT -bool pubkey32_from_node_id(struct pubkey32 *key, const struct node_id *id) +bool point32_from_node_id(struct point32 *key, const struct node_id *id) { struct pubkey k; if (!pubkey_from_node_id(&k, id)) diff --git a/common/node_id.h b/common/node_id.h index 35134d035..5f9fbb1ff 100644 --- a/common/node_id.h +++ b/common/node_id.h @@ -26,7 +26,7 @@ bool pubkey_from_node_id(struct pubkey *key, const struct node_id *id); /* Returns false if not a valid pubkey: relatively expensive */ WARN_UNUSED_RESULT -bool pubkey32_from_node_id(struct pubkey32 *key, const struct node_id *id); +bool point32_from_node_id(struct point32 *key, const struct node_id *id); /* Convert to hex string of SEC1 encoding. */ char *node_id_to_hexstr(const tal_t *ctx, const struct node_id *id); diff --git a/common/type_to_string.h b/common/type_to_string.h index 40834c49e..1bdc66542 100644 --- a/common/type_to_string.h +++ b/common/type_to_string.h @@ -7,7 +7,7 @@ /* This must match the type_to_string_ cases. */ union printable_types { const struct pubkey *pubkey; - const struct pubkey32 *pubkey32; + const struct point32 *point32; const struct node_id *node_id; const struct bitcoin_txid *bitcoin_txid; const struct bitcoin_blkid *bitcoin_blkid; diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py index 53eafd99d..8742bf727 100644 --- a/contrib/pyln-testing/pyln/testing/fixtures.py +++ b/contrib/pyln-testing/pyln/testing/fixtures.py @@ -274,7 +274,7 @@ def _extra_validator(): return False return instance[0:2] == "02" or instance[0:2] == "03" - def is_pubkey32(checker, instance): + def is_point32(checker, instance): """x-only BIP-340 public key""" if not checker.is_type(instance, "hex"): return False @@ -319,7 +319,7 @@ def _extra_validator(): "txid": is_txid, "signature": is_signature, "bip340sig": is_bip340sig, - "pubkey32": is_pubkey32, + "point32": is_point32, "short_channel_id": is_short_channel_id, }) diff --git a/devtools/bolt12-cli.c b/devtools/bolt12-cli.c index 7ffdfbcc2..1cfdb2c23 100644 --- a/devtools/bolt12-cli.c +++ b/devtools/bolt12-cli.c @@ -144,9 +144,9 @@ static void print_vendor(const char *vendor) printf("vendor: %.*s\n", (int)tal_bytelen(vendor), vendor); } -static void print_node_id(const struct pubkey32 *node_id) +static void print_node_id(const struct point32 *node_id) { - printf("node_id: %s\n", type_to_string(tmpctx, struct pubkey32, node_id)); + printf("node_id: %s\n", type_to_string(tmpctx, struct point32, node_id)); } static void print_quantity_min(u64 min) @@ -299,7 +299,7 @@ static void print_refund_for(const struct sha256 *payment_hash) static bool print_signature(const char *messagename, const char *fieldname, const struct tlv_field *fields, - const struct pubkey32 *node_id, + const struct point32 *node_id, const struct bip340sig *sig) { struct sha256 m, shash; @@ -358,11 +358,11 @@ static bool print_recurrence_counter_with_base(const u32 *recurrence_counter, return true; } -static void print_payer_key(const struct pubkey32 *payer_key, +static void print_payer_key(const struct point32 *payer_key, const u8 *payer_info) { printf("payer_key: %s", - type_to_string(tmpctx, struct pubkey32, payer_key)); + type_to_string(tmpctx, struct point32, payer_key)); if (payer_info) printf(" (payer_info %s)", tal_hex(tmpctx, payer_info)); printf("\n"); diff --git a/doc/lightning-decode.7.md b/doc/lightning-decode.7.md index a5958755f..c12deaad9 100644 --- a/doc/lightning-decode.7.md +++ b/doc/lightning-decode.7.md @@ -24,7 +24,7 @@ On success, an object is returned, containing: If **type** is "bolt12 offer", and **valid** is *true*: - **offer_id** (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) - - **node_id** (pubkey32): x-only public key of the offering node + - **node_id** (point32): x-only public key of the offering node - **description** (string): the description of the purpose of the offer - **signature** (bip340sig, optional): BIP-340 signature of the *node_id* on this offer - **chains** (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only): @@ -64,7 +64,7 @@ If **type** is "bolt12 offer", and **valid** is *false*: - **warning_offer_missing_description**: No **description** If **type** is "bolt12 invoice", and **valid** is *true*: - - **node_id** (pubkey32): x-only public key of the offering node + - **node_id** (point32): x-only public key of the offering node - **signature** (bip340sig): BIP-340 signature of the *node_id* on this offer - **amount_msat** (msat): the amount in bitcoin - **description** (string): the description of the purpose of the offer @@ -88,7 +88,7 @@ If **type** is "bolt12 invoice", and **valid** is *true*: - **recurrence_counter** (u32, optional): the 0-based counter for a recurring payment - **recurrence_start** (u32, optional): the optional start period for a recurring payment - **recurrence_basetime** (u32, optional): the UNIX timestamp of the first recurrence period start - - **payer_key** (pubkey32, optional): the transient key which identifies the payer + - **payer_key** (point32, optional): the transient key which identifies the payer - **payer_info** (hex, optional): the payer-provided blob to derive payer_key - **fallbacks** (array of objects, optional): onchain addresses: - **version** (u8): Segwit address version @@ -114,7 +114,7 @@ If **type** is "bolt12 invoice", and **valid** is *false*: If **type** is "bolt12 invoice_request", and **valid** is *true*: - **offer_id** (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) - - **payer_key** (pubkey32): the transient key which identifies the payer + - **payer_key** (point32): the transient key which identifies the payer - **chains** (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only): - the genesis blockhash (always 64 characters) - **amount_msat** (msat, optional): the amount in bitcoin @@ -182,4 +182,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:d9e00b0a8c93fecd75aab0688204601a7ceeca0f424012cf0d04ce24b6017aee) +[comment]: # ( SHA256STAMP:f12157fe0af8ff3c9569374cc95bdbdd9df00c9a818fbfe30450a3eea020053a) diff --git a/doc/schemas/decode.schema.json b/doc/schemas/decode.schema.json index 33890f511..7be8b710a 100644 --- a/doc/schemas/decode.schema.json +++ b/doc/schemas/decode.schema.json @@ -40,7 +40,7 @@ "minLength": 64 }, "node_id": { - "type": "pubkey32", + "type": "point32", "description": "x-only public key of the offering node" }, "signature": { @@ -275,7 +275,7 @@ "minLength": 64 }, "node_id": { - "type": "pubkey32", + "type": "point32", "description": "x-only public key of the offering node" }, "signature": { @@ -370,7 +370,7 @@ "description": "the UNIX timestamp of the first recurrence period start" }, "payer_key": { - "type": "pubkey32", + "type": "point32", "description": "the transient key which identifies the payer" }, "payer_info": { @@ -586,7 +586,7 @@ "description": "the optional start period for a recurring payment" }, "payer_key": { - "type": "pubkey32", + "type": "point32", "description": "the transient key which identifies the payer" }, "payer_info": { diff --git a/hsmd/hsmd_wire.csv b/hsmd/hsmd_wire.csv index 051b09fcd..2aada5727 100644 --- a/hsmd/hsmd_wire.csv +++ b/hsmd/hsmd_wire.csv @@ -20,7 +20,7 @@ msgdata,hsmd_init,dev_force_channel_secrets_shaseed,?sha256, msgtype,hsmd_init_reply,111 msgdata,hsmd_init_reply,node_id,node_id, msgdata,hsmd_init_reply,bip32,ext_key, -msgdata,hsmd_init_reply,bolt12,pubkey32, +msgdata,hsmd_init_reply,bolt12,point32, msgdata,hsmd_init_reply,onion_reply_secret,secret, # Get a new HSM FD, with the specified capabilities diff --git a/hsmd/libhsmd.c b/hsmd/libhsmd.c index 648b4b009..8a358bcc8 100644 --- a/hsmd/libhsmd.c +++ b/hsmd/libhsmd.c @@ -210,7 +210,7 @@ static void node_key(struct privkey *node_privkey, struct pubkey *node_id) /*~ This returns the secret and/or public x-only key for this node. */ static void node_schnorrkey(secp256k1_keypair *node_keypair, - struct pubkey32 *node_id32) + struct point32 *node_id32) { secp256k1_keypair unused_kp; struct privkey node_privkey; @@ -536,7 +536,7 @@ static u8 *handle_sign_bolt12(struct hsmd_client *c, const u8 *msg_in) node_schnorrkey(&kp, NULL); } else { /* If we're tweaking key, we use bolt12 key */ - struct pubkey32 bolt12; + struct point32 bolt12; struct sha256 tweak; if (secp256k1_keypair_xonly_pub(secp256k1_ctx, @@ -1465,7 +1465,7 @@ u8 *hsmd_init(struct secret hsm_secret, { u8 bip32_seed[BIP32_ENTROPY_LEN_256]; struct pubkey key; - struct pubkey32 bolt12; + struct point32 bolt12; u32 salt = 0; struct ext_key master_extkey, child_extkey; struct node_id node_id; diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index d04b45964..274995422 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -107,7 +107,7 @@ struct lightningd { struct node_id id; /* The public base for our payer_id keys */ - struct pubkey32 bolt12_base; + struct point32 bolt12_base; /* The secret we put in onion message paths to know it's ours. */ struct secret onion_reply_secret; diff --git a/lightningd/offer.c b/lightningd/offer.c index a55695990..da81c9f53 100644 --- a/lightningd/offer.c +++ b/lightningd/offer.c @@ -54,7 +54,7 @@ static void hsm_sign_b12(struct lightningd *ld, const char *fieldname, const struct sha256 *merkle, const u8 *publictweak, - const struct pubkey32 *key, + const struct point32 *key, struct bip340sig *sig) { u8 *msg; @@ -76,7 +76,7 @@ static void hsm_sign_b12(struct lightningd *ld, sighash.u.u8, &key->pubkey) != 1) fatal("HSM gave bad signature %s for pubkey %s", type_to_string(tmpctx, struct bip340sig, sig), - type_to_string(tmpctx, struct pubkey32, key)); + type_to_string(tmpctx, struct point32, key)); } static struct command_result *json_createoffer(struct command *cmd, @@ -91,7 +91,7 @@ static struct command_result *json_createoffer(struct command *cmd, const char *b12str, *b12str_nosig; bool *single_use; enum offer_status status; - struct pubkey32 key; + struct point32 key; bool created; if (!param(cmd, buffer, params, @@ -107,7 +107,7 @@ static struct command_result *json_createoffer(struct command *cmd, status = OFFER_MULTIPLE_USE_UNUSED; merkle_tlv(offer->fields, &merkle); offer->signature = tal(offer, struct bip340sig); - if (!pubkey32_from_node_id(&key, &cmd->ld->id)) + if (!point32_from_node_id(&key, &cmd->ld->id)) fatal("invalid own node_id?"); hsm_sign_b12(cmd->ld, "offer", "signature", &merkle, NULL, &key, offer->signature); @@ -388,7 +388,7 @@ static struct command_result *param_b12_invreq(struct command *cmd, static bool payer_key(struct lightningd *ld, const u8 *public_tweak, size_t public_tweak_len, - struct pubkey32 *key) + struct point32 *key) { struct sha256 tweakhash; secp256k1_pubkey tweaked; @@ -454,7 +454,7 @@ static struct command_result *json_createinvoicerequest(struct command *cmd, tal_bytelen(invreq->payer_info)); } - invreq->payer_key = tal(invreq, struct pubkey32); + invreq->payer_key = tal(invreq, struct point32); if (!payer_key(cmd->ld, invreq->payer_info, tal_bytelen(invreq->payer_info), invreq->payer_key)) { @@ -502,7 +502,7 @@ static struct command_result *json_payersign(struct command *cmd, u8 *tweak; struct bip340sig sig; const char *messagename, *fieldname; - struct pubkey32 key; + struct point32 key; if (!param(cmd, buffer, params, p_req("messagename", param_string, &messagename), diff --git a/plugins/fetchinvoice.c b/plugins/fetchinvoice.c index 2f942ba4e..8cebdde07 100644 --- a/plugins/fetchinvoice.c +++ b/plugins/fetchinvoice.c @@ -216,7 +216,7 @@ static struct command_result *handle_invreq_response(struct command *cmd, /* BOLT-offers #12: * - MUST reject the invoice unless `node_id` is equal to the offer. */ - if (!pubkey32_eq(sent->offer->node_id, inv->node_id)) { + if (!point32_eq(sent->offer->node_id, inv->node_id)) { badfield = "node_id"; goto badinv; } @@ -613,8 +613,8 @@ static enum nodeid_parity node_parity(const struct gossmap *gossmap, return id.k[0]; } -static void node_id_from_pubkey32(struct node_id *nid, - const struct pubkey32 *node32_id, +static void node_id_from_point32(struct node_id *nid, + const struct point32 *node32_id, enum nodeid_parity parity) { assert(parity == SECP256K1_TAG_PUBKEY_EVEN @@ -629,7 +629,7 @@ static void node_id_from_pubkey32(struct node_id *nid, * for 33rd nodeid byte. */ static struct pubkey *path_to_node(const tal_t *ctx, struct plugin *plugin, - const struct pubkey32 *node32_id, + const struct point32 *node32_id, enum nodeid_parity *parity) { struct route_hop *r; @@ -642,11 +642,11 @@ static struct pubkey *path_to_node(const tal_t *ctx, /* We try both parities. */ *parity = nodeid_parity_even; - node_id_from_pubkey32(&dstid, node32_id, *parity); + node_id_from_point32(&dstid, node32_id, *parity); dst = gossmap_find_node(gossmap, &dstid); if (!dst) { *parity = nodeid_parity_odd; - node_id_from_pubkey32(&dstid, node32_id, *parity); + node_id_from_point32(&dstid, node32_id, *parity); dst = gossmap_find_node(gossmap, &dstid); if (!dst) { *parity = nodeid_parity_unknown; @@ -999,7 +999,7 @@ static struct command_result *try_other_parity(struct command *cmd, * to them. */ static struct command_result * connect_direct(struct command *cmd, - const struct pubkey32 *dst, + const struct point32 *dst, enum nodeid_parity parity, struct command_result *(*cb)(struct command *command, const char *buf, @@ -1016,15 +1016,15 @@ connect_direct(struct command *cmd, if (parity == nodeid_parity_unknown) { plugin_notify_message(cmd, LOG_INFORM, "Cannot find route, trying connect to 02/03%s directly", - type_to_string(tmpctx, struct pubkey32, dst)); + type_to_string(tmpctx, struct point32, dst)); /* Try even first. */ - node_id_from_pubkey32(&ca->node_id, dst, SECP256K1_TAG_PUBKEY_EVEN); + node_id_from_point32(&ca->node_id, dst, SECP256K1_TAG_PUBKEY_EVEN); } else { plugin_notify_message(cmd, LOG_INFORM, "Cannot find route, trying connect to %02x%s directly", parity, - type_to_string(tmpctx, struct pubkey32, dst)); - node_id_from_pubkey32(&ca->node_id, dst, parity); + type_to_string(tmpctx, struct point32, dst)); + node_id_from_point32(&ca->node_id, dst, parity); } /* Make a direct path -> dst. */ @@ -1043,7 +1043,7 @@ connect_direct(struct command *cmd, "Cannot find route, but" " fetchplugin-noconnect set:" " trying direct anyway to %s", - type_to_string(tmpctx, struct pubkey32, + type_to_string(tmpctx, struct point32, dst)); return cb(cmd, NULL, NULL, sent); } @@ -1183,7 +1183,7 @@ force_payer_secret(struct command *cmd, if (secp256k1_keypair_create(secp256k1_ctx, &kp, payer_secret->data) != 1) return command_fail(cmd, LIGHTNINGD, "Bad payer_secret"); - invreq->payer_key = tal(invreq, struct pubkey32); + invreq->payer_key = tal(invreq, struct point32); /* Docs say this only happens if arguments are invalid! */ if (secp256k1_keypair_xonly_pub(secp256k1_ctx, &invreq->payer_key->pubkey, NULL, @@ -1691,7 +1691,7 @@ static struct command_result *json_sendinvoice(struct command *cmd, * - MUST set `node_id` to the id of the node to send payment to. * - MUST set `description` the same as the offer. */ - sent->inv->node_id = tal(sent->inv, struct pubkey32); + sent->inv->node_id = tal(sent->inv, struct point32); /* This only fails if pubkey is invalid. */ if (!secp256k1_xonly_pubkey_from_pubkey(secp256k1_ctx, @@ -1853,7 +1853,7 @@ static struct command_result *json_rawrequest(struct command *cmd, struct sent *sent = tal(cmd, struct sent); u32 *timeout; struct node_id *node_id; - struct pubkey32 node_id32; + struct point32 node_id32; enum nodeid_parity parity; if (!param(cmd, buffer, params, diff --git a/plugins/offers.c b/plugins/offers.c index 906ae07e8..46809833e 100644 --- a/plugins/offers.c +++ b/plugins/offers.c @@ -14,7 +14,7 @@ #include #include -struct pubkey32 id; +struct point32 id; u32 cltv_final; bool offers_enabled; @@ -470,7 +470,7 @@ static void json_add_offer(struct json_stream *js, const struct tlv_offer *offer } if (offer->node_id) - json_add_pubkey32(js, "node_id", offer->node_id); + json_add_point32(js, "node_id", offer->node_id); else valid = false; @@ -636,7 +636,7 @@ static void json_add_b12_invoice(struct json_stream *js, } if (invoice->payer_key) - json_add_pubkey32(js, "payer_key", invoice->payer_key); + json_add_point32(js, "payer_key", invoice->payer_key); if (invoice->payer_info) json_add_hex_talarr(js, "payer_info", invoice->payer_info); if (invoice->payer_note) @@ -726,7 +726,7 @@ static void json_add_b12_invoice(struct json_stream *js, } /* invoice_decode checked these */ - json_add_pubkey32(js, "node_id", invoice->node_id); + json_add_point32(js, "node_id", invoice->node_id); json_add_bip340sig(js, "signature", invoice->signature); json_add_bool(js, "valid", valid); @@ -767,7 +767,7 @@ static void json_add_invoice_request(struct json_stream *js, json_add_u32(js, "recurrence_start", *invreq->recurrence_start); if (invreq->payer_key) - json_add_pubkey32(js, "payer_key", invreq->payer_key); + json_add_point32(js, "payer_key", invreq->payer_key); else { json_add_string(js, "warning_invoice_request_missing_payer_key", "invoice_request requires payer_key"); diff --git a/plugins/offers_invreq_hook.c b/plugins/offers_invreq_hook.c index b622c5b94..69fcb2a70 100644 --- a/plugins/offers_invreq_hook.c +++ b/plugins/offers_invreq_hook.c @@ -137,14 +137,14 @@ static void set_recurring_inv_expiry(struct tlv_invoice *inv, u64 last_pay) /* We rely on label forms for uniqueness. */ static void json_add_label(struct json_stream *js, const struct sha256 *offer_id, - const struct pubkey32 *payer_key, + const struct point32 *payer_key, const u32 counter) { char *label; label = tal_fmt(tmpctx, "%s-%s-%u", type_to_string(tmpctx, struct sha256, offer_id), - type_to_string(tmpctx, struct pubkey32, + type_to_string(tmpctx, struct point32, payer_key), counter); json_add_string(js, "label", label); @@ -423,7 +423,7 @@ static struct command_result *check_previous_invoice(struct command *cmd, * - MUST fail the request if `payer_signature` is not correct. */ static bool check_payer_sig(const struct tlv_invoice_request *invreq, - const struct pubkey32 *payer_key, + const struct point32 *payer_key, const struct bip340sig *sig) { struct sha256 merkle, sighash; @@ -775,7 +775,7 @@ static struct command_result *listoffers_done(struct command *cmd, /* FIXME: Insert paths and payinfo */ ir->inv->vendor = tal_dup_talarr(ir->inv, char, ir->offer->vendor); - ir->inv->node_id = tal_dup(ir->inv, struct pubkey32, ir->offer->node_id); + ir->inv->node_id = tal_dup(ir->inv, struct point32, ir->offer->node_id); /* BOLT-offers #12: * - MUST set (or not set) `quantity` exactly as the invoice_request * did. @@ -786,7 +786,7 @@ static struct command_result *listoffers_done(struct command *cmd, /* BOLT-offers #12: * - MUST set `payer_key` exactly as the invoice_request did. */ - ir->inv->payer_key = tal_dup(ir->inv, struct pubkey32, + ir->inv->payer_key = tal_dup(ir->inv, struct point32, ir->invreq->payer_key); /* BOLT-offers #12: diff --git a/plugins/offers_offer.c b/plugins/offers_offer.c index 9769d25bc..3c40cc2a6 100644 --- a/plugins/offers_offer.c +++ b/plugins/offers_offer.c @@ -403,7 +403,7 @@ struct command_result *json_offer(struct command *cmd, = tal_dup_arr(offer, char, vendor, strlen(vendor), 0); } - offer->node_id = tal_dup(offer, struct pubkey32, &id); + offer->node_id = tal_dup(offer, struct point32, &id); /* If they specify a different currency, warn if we can't * convert it! */ @@ -467,7 +467,7 @@ struct command_result *json_offerout(struct command *cmd, offer->vendor = tal_dup_arr(offer, char, vendor, strlen(vendor), 0); - offer->node_id = tal_dup(offer, struct pubkey32, &id); + offer->node_id = tal_dup(offer, struct point32, &id); req = jsonrpc_request_start(cmd->plugin, cmd, "createoffer", check_result, forward_error, diff --git a/plugins/offers_offer.h b/plugins/offers_offer.h index 1cec6e268..a0e436ac2 100644 --- a/plugins/offers_offer.h +++ b/plugins/offers_offer.h @@ -3,7 +3,7 @@ #include "config.h" #include -extern struct pubkey32 id; +extern struct point32 id; extern bool offers_enabled; struct command_result *json_offer(struct command *cmd, diff --git a/plugins/pay.c b/plugins/pay.c index e4ab92470..2a46cb8dc 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -2073,7 +2073,7 @@ static struct command_result *json_paymod(struct command *cmd, } else invmsat = NULL; - /* FIXME: gossmap should store as pubkey32 */ + /* FIXME: gossmap should store as point32 */ p->destination = tal(p, struct node_id); gossmap_guess_node_id(get_gossmap(cmd->plugin), b12->node_id, p->destination);