BOLT12: use point32 instead of pubkey32.

That's the modern BOLT12 term.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-10-08 09:24:42 +10:30
committed by Christian Decker
parent 51ed7557a1
commit 8f582e770c
27 changed files with 93 additions and 88 deletions

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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? */

View File

@@ -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)
{

View File

@@ -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);

View File

@@ -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))

View File

@@ -8,7 +8,7 @@
#include <common/fp16.h>
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 */

View File

@@ -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];

View File

@@ -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,

View File

@@ -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))

View File

@@ -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);

View File

@@ -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;

View File

@@ -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,
})

View File

@@ -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");

View File

@@ -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: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:d9e00b0a8c93fecd75aab0688204601a7ceeca0f424012cf0d04ce24b6017aee)
[comment]: # ( SHA256STAMP:f12157fe0af8ff3c9569374cc95bdbdd9df00c9a818fbfe30450a3eea020053a)

View File

@@ -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": {

View File

@@ -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
1 # Clients should not give a bad request but not the HSM's decision to crash.
20 msgdata,hsmd_init_reply,bip32,ext_key,
21 msgdata,hsmd_init_reply,bolt12,pubkey32, msgdata,hsmd_init_reply,bolt12,point32,
22 msgdata,hsmd_init_reply,onion_reply_secret,secret,
23 # Get a new HSM FD, with the specified capabilities
24 msgtype,hsmd_client_hsmfd,9
25 # Which identity to use for requests
26 msgdata,hsmd_client_hsmfd,id,node_id,

View File

@@ -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;

View File

@@ -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;

View File

@@ -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),

View File

@@ -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,

View File

@@ -14,7 +14,7 @@
#include <plugins/offers_invreq_hook.h>
#include <plugins/offers_offer.h>
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");

View File

@@ -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:

View File

@@ -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,

View File

@@ -3,7 +3,7 @@
#include "config.h"
#include <plugins/libplugin.h>
extern struct pubkey32 id;
extern struct point32 id;
extern bool offers_enabled;
struct command_result *json_offer(struct command *cmd,

View File

@@ -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);