wire: rename "offer_node_id" to "offer_issuer_id" to match latest BOLT.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-08-01 09:32:53 +09:30
parent f42e9b3fe6
commit 925e90ee8b
22 changed files with 751 additions and 684 deletions

View File

@ -963,6 +963,7 @@
"Decode.offer_features": 13,
"Decode.offer_id": 3,
"Decode.offer_issuer": 12,
"Decode.offer_issuer_id": 83,
"Decode.offer_metadata": 5,
"Decode.offer_node_id": 17,
"Decode.offer_paths[]": 16,
@ -1002,6 +1003,7 @@
"Decode.warning_missing_invreq_metadata": 35,
"Decode.warning_missing_invreq_payer_id": 36,
"Decode.warning_missing_offer_description": 22,
"Decode.warning_missing_offer_issuer_id": 84,
"Decode.warning_missing_offer_node_id": 20,
"Decode.warning_rune_invalid_utf8": 74,
"Decode.warning_unknown_offer_currency": 7
@ -4549,6 +4551,10 @@
"added": "pre-v0.10.1",
"deprecated": null
},
"Decode.offer_issuer_id": {
"added": "v24.08",
"deprecated": null
},
"Decode.offer_metadata": {
"added": "pre-v0.10.1",
"deprecated": null
@ -4837,6 +4843,10 @@
"added": "pre-v0.10.1",
"deprecated": null
},
"Decode.warning_missing_offer_issuer_id": {
"added": "v24.08",
"deprecated": null
},
"Decode.warning_missing_offer_node_id": {
"added": "pre-v0.10.1",
"deprecated": null

Binary file not shown.

BIN
cln-grpc/src/convert.rs generated

Binary file not shown.

BIN
cln-rpc/src/model.rs generated

Binary file not shown.

View File

@ -223,8 +223,8 @@ struct tlv_offer *offer_decode(const tal_t *ctx,
}
/* FIXME(vincenzopalazzo): node id can be null when we use blinded path. */
if (!offer->offer_node_id) {
*fail = tal_strdup(ctx, "Offer does not contain a node_id");
if (!offer->offer_issuer_id) {
*fail = tal_strdup(ctx, "Offer does not contain an issuer_id");
return tal_free(offer);
}

View File

@ -155,8 +155,8 @@ int main(int argc, char *argv[])
memset(&carol, 'C', sizeof(carol));
offer = tlv_offer_new(tmpctx);
offer->offer_node_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_node_id));
offer->offer_issuer_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_issuer_id));
offer->offer_description = tal_utf8(tmpctx, "Test vectors");
printf("[\n");
@ -275,14 +275,14 @@ int main(int argc, char *argv[])
/* Now let's do the invalid ones! */
/* Invalid encoding forms. */
/* offer_node_id then description */
/* offer_issuer_id then description */
print_malformed_tlv("lno",
"1621020202020202020202020202020202020202020202020202020202020202020202" /* offer_node_id */
"1621020202020202020202020202020202020202020202020202020202020202020202" /* offer_issuer_id */
"0A05414C494345", /* offer_description */
"Malformed: fields out of order");
print_malformed_tlv("lno",
"0A05414C494345" /* offer_description */
"1621020202020202020202020202020202020202020202020202020202020202020202" /* offer_node_id */
"1621020202020202020202020202020202020202020202020202020202020202020202" /* offer_issuer_id */
"48206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000",
"Malformed: unknown even TLV type 78");
/* various forms of truncation */
@ -360,7 +360,7 @@ int main(int argc, char *argv[])
print_malformed_tlv("lno",
"0A05414C494345"
"1621020303030303030303030303030303030303030303030303030303030303030303",
"Malformed: invalid offer_node_id");
"Malformed: invalid offer_issuer_id");
/* Now these are simply invalid, not bad encodings */
/* BOLT-offers #12:
@ -370,13 +370,13 @@ int main(int argc, char *argv[])
*/
print_malformed_tlv("lno",
"0A05414C494345" /* offer_description */
"1621020202020202020202020202020202020202020202020202020202020202020202" /* offer_node_id */
"1621020202020202020202020202020202020202020202020202020202020202020202" /* offer_issuer_id */
"50206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000",
"Contains type >= 80");
offer = tlv_offer_new(tmpctx);
offer->offer_node_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_node_id));
offer->offer_issuer_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_issuer_id));
offer->offer_description = tal_utf8(tmpctx, "Test vectors");
offer->offer_features = tal_arr(offer, u8, 0);
@ -392,17 +392,17 @@ int main(int argc, char *argv[])
/* BOLT-offers #12:
* - if `offer_description` is not set:
* - MUST NOT respond to the offer.
* - if `offer_node_id` is not set:
* - if `offer_issuer_id` is not set:
* - MUST NOT respond to the offer.
*/
offer->offer_description = NULL;
print_invalid_offer(offer, "Missing offer_description");
offer->offer_description = tal_utf8(tmpctx, "Test vectors");
offer->offer_node_id = NULL;
print_invalid_offer(offer, "Missing offer_node_id");
offer->offer_node_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_node_id));
offer->offer_issuer_id = NULL;
print_invalid_offer(offer, "Missing offer_issuer_id");
offer->offer_issuer_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_issuer_id));
printf("]\n");
common_shutdown();

View File

@ -118,7 +118,7 @@ int main(int argc, char *argv[])
/* BOLT-offers #12:
* A writer of an offer:
* - MUST NOT set any tlv fields greater or equal to 80, or tlv field 0.
* - MUST set `offer_node_id` to the node's public key to request the invoice from.
* - MUST set `offer_issuer_id` to the node's public key to request the invoice from.
* - MUST set `offer_description` to a complete description of the purpose
* of the payment.
* - if the chain for the invoice is not solely bitcoin:
@ -166,8 +166,8 @@ int main(int argc, char *argv[])
* - MUST NOT set `offer_quantity_max`.
*/
memset(&alice, 'A', sizeof(alice));
offer->offer_node_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_node_id));
offer->offer_issuer_id = tal(offer, struct pubkey);
assert(pubkey_from_secret(&alice, offer->offer_issuer_id));
offer->offer_description = tal_utf8(offer, "An example description");
offer->offer_issuer = tal_utf8(offer, "BOLT 12 industries");
offer->offer_amount = tal(offer, u64);

View File

@ -317,7 +317,7 @@ int main(int argc, char *argv[])
memset(&bob_secret, 'B', sizeof(bob_secret));
pubkey_from_secret(&bob_secret, &bob);
invreq->offer_node_id = tal_dup(invreq, struct pubkey, &alice);
invreq->offer_issuer_id = tal_dup(invreq, struct pubkey, &alice);
invreq->offer_description = tal_dup_arr(invreq, char, "A Mathematical Treatise", strlen("A Mathematical Treatise"), 0);
invreq->offer_amount = tal(invreq, u64);
*invreq->offer_amount = 100;
@ -343,7 +343,7 @@ int main(int argc, char *argv[])
char *invreqtext = invrequest_encode(tmpctx, invreq);
invreq = invrequest_decode(tmpctx, invreqtext, strlen(invreqtext), NULL, NULL, &fail);
json_out("{\"comment\": \"invoice_request test: offer_node_id = Alice (privkey 0x414141...), offer_description = 'A Mathematical Treatise', offer_amount = 100, offer_currency = 'USD', invreq_payer_id = Bob (privkey 0x424242...), invreq_metadata = 0x0000000000000000\",");
json_out("{\"comment\": \"invoice_request test: offer_issuer_id = Alice (privkey 0x414141...), offer_description = 'A Mathematical Treatise', offer_amount = 100, offer_currency = 'USD', invreq_payer_id = Bob (privkey 0x424242...), invreq_metadata = 0x0000000000000000\",");
json_out("\"bolt12\": \"%s\",", invreqtext);
json_out("\"tlv\": \"invoice_request\",");
@ -358,7 +358,7 @@ int main(int argc, char *argv[])
fieldwires[2] = tlv(8, "\x64", 1);
/* offer_description: A Mathematical Treatise */
fieldwires[3] = tlv(10, "A Mathematical Treatise", strlen("A Mathematical Treatise"));
/* offer_node_id: Alice */
/* offer_issuer_id: Alice */
pubkey_to_der(node_id, &alice);
fieldwires[4] = tlv(22, node_id, PUBKEY_CMPR_LEN);
/* invreq_payer_id: Bob */

View File

@ -5562,8 +5562,7 @@
},
"then": {
"required": [
"offer_id",
"offer_node_id"
"offer_id"
],
"additionalProperties": false,
"properties": {
@ -5730,7 +5729,14 @@
"offer_node_id": {
"type": "pubkey",
"description": [
"Public key of the offering node."
"Obsolete name for offer_issuer_id."
]
},
"offer_issuer_id": {
"type": "pubkey",
"added": "v24.08",
"description": [
"The pubkey associated with the offer (can be a node id)."
]
},
"offer_recurrence": {
@ -5902,6 +5908,13 @@
"`offer_node_id` is not present."
]
},
"warning_missing_offer_issuer_id": {
"type": "string",
"added": "v24.08",
"description": [
"`offer_issuer_id` is not present and there are no offer_paths"
]
},
"warning_invalid_offer_description": {
"type": "string",
"description": [
@ -5948,7 +5961,6 @@
},
"then": {
"required": [
"offer_node_id",
"invreq_metadata",
"invreq_payer_id",
"signature"
@ -6123,6 +6135,13 @@
"Public key of the offering node."
]
},
"offer_issuer_id": {
"type": "pubkey",
"added": "v24.08",
"description": [
"Public key of the offering node (can be a node id)."
]
},
"offer_recurrence": {
"type": "object",
"description": [
@ -6345,6 +6364,7 @@
"offer_quantity_max": {},
"offer_paths": {},
"offer_node_id": {},
"offer_issuer_id": {},
"offer_recurrence": {},
"invreq_metadata": {},
"invreq_payer_id": {},
@ -6431,7 +6451,6 @@
},
"then": {
"required": [
"offer_node_id",
"invreq_metadata",
"invreq_payer_id",
"invoice_paths",
@ -6610,6 +6629,13 @@
"Public key of the offering node."
]
},
"offer_issuer_id": {
"type": "pubkey",
"added": "v24.08",
"description": [
"Public key of the offering node (can be a node id)."
]
},
"offer_recurrence": {
"type": "object",
"description": [
@ -6926,7 +6952,7 @@
"invoice_node_id": {
"type": "pubkey",
"description": [
"The id to pay (usually the same as offer_node_id)."
"The id to pay (usually the same as offer_issuer_id)."
]
},
"invoice_recurrence_basetime": {
@ -6938,7 +6964,7 @@
"signature": {
"type": "bip340sig",
"description": [
"BIP-340 signature of the `offer_node_id` on this invoice."
"BIP-340 signature of the `offer_issuer_id` on this invoice."
]
},
"unknown_invoice_tlvs": {
@ -7017,6 +7043,7 @@
"offer_quantity_max": {},
"offer_paths": {},
"offer_node_id": {},
"offer_issuer_id": {},
"offer_recurrence": {},
"invreq_metadata": {},
"invreq_payer_id": {},

File diff suppressed because one or more lines are too long

View File

@ -1280,6 +1280,7 @@ def decode2py(m):
"offer_features": hexlify(m.offer_features), # PrimitiveField in generate_composite
"offer_id": hexlify(m.offer_id), # PrimitiveField in generate_composite
"offer_issuer": m.offer_issuer, # PrimitiveField in generate_composite
"offer_issuer_id": hexlify(m.offer_issuer_id), # PrimitiveField in generate_composite
"offer_metadata": hexlify(m.offer_metadata), # PrimitiveField in generate_composite
"offer_node_id": hexlify(m.offer_node_id), # PrimitiveField in generate_composite
"offer_quantity_max": m.offer_quantity_max, # PrimitiveField in generate_composite
@ -1311,6 +1312,7 @@ def decode2py(m):
"warning_missing_invreq_metadata": m.warning_missing_invreq_metadata, # PrimitiveField in generate_composite
"warning_missing_invreq_payer_id": m.warning_missing_invreq_payer_id, # PrimitiveField in generate_composite
"warning_missing_offer_description": m.warning_missing_offer_description, # PrimitiveField in generate_composite
"warning_missing_offer_issuer_id": m.warning_missing_offer_issuer_id, # PrimitiveField in generate_composite
"warning_missing_offer_node_id": m.warning_missing_offer_node_id, # PrimitiveField in generate_composite
"warning_rune_invalid_utf8": m.warning_rune_invalid_utf8, # PrimitiveField in generate_composite
"warning_unknown_offer_currency": m.warning_unknown_offer_currency, # PrimitiveField in generate_composite

View File

@ -454,7 +454,7 @@ static u64 get_offer_type(const char *name)
* 1. type: 20 (`offer_quantity_max`)
* 2. data:
* * [`tu64`:`max`]
* 1. type: 22 (`offer_node_id`)
* 1. type: 22 (`offer_issuer_id`)
* 2. data:
* * [`point`:`node_id`]
*/
@ -468,7 +468,7 @@ static u64 get_offer_type(const char *name)
{ "offer_paths", 16 },
{ "offer_issuer", 18 },
{ "offer_quantity_max", 20 },
{ "offer_node_id", 22 },
{ "offer_issuer_id", 22 },
/* BOLT-offers #12:
* 1. `tlv_stream`: `invoice_request`
* 2. types:
@ -505,7 +505,7 @@ static u64 get_offer_type(const char *name)
* 1. type: 20 (`offer_quantity_max`)
* 2. data:
* * [`tu64`:`max`]
* 1. type: 22 (`offer_node_id`)
* 1. type: 22 (`offer_issuer_id`)
* 2. data:
* * [`point`:`node_id`]
* 1. type: 80 (`invreq_chain`)
@ -574,7 +574,7 @@ static u64 get_offer_type(const char *name)
* 1. type: 20 (`offer_quantity_max`)
* 2. data:
* * [`tu64`:`max`]
* 1. type: 22 (`offer_node_id`)
* 1. type: 22 (`offer_issuer_id`)
* 2. data:
* * [`point`:`node_id`]
* 1. type: 80 (`invreq_chain`)
@ -797,8 +797,9 @@ int main(int argc, char *argv[])
well_formed &= print_utf8("offer_issuer", offer->offer_issuer);
if (offer->offer_quantity_max)
print_u64("offer_quantity_max", *offer->offer_quantity_max);
if (must_have(offer, offer_node_id))
print_node_id("offer_node_id", offer->offer_node_id);
/* FIXME: can have path instead! */
if (must_have(offer, offer_issuer_id))
print_node_id("offer_issuer_id", offer->offer_issuer_id);
if (offer->offer_recurrence)
well_formed &= print_recurrance(offer->offer_recurrence,
offer->offer_recurrence_paywindow,
@ -814,7 +815,7 @@ int main(int argc, char *argv[])
if (!invreq)
errx(ERROR_BAD_DECODE, "Bad invreq: %s", fail);
if (invreq->offer_node_id) {
if (invreq->offer_issuer_id) {
invreq_offer_id(invreq, &offer_id);
print_hash("offer_id", &offer_id);
}
@ -842,8 +843,8 @@ int main(int argc, char *argv[])
well_formed &= print_utf8("offer_issuer", invreq->offer_issuer);
if (invreq->offer_quantity_max)
print_u64("offer_quantity_max", *invreq->offer_quantity_max);
if (invreq->offer_node_id)
print_node_id("offer_node_id", invreq->offer_node_id);
if (invreq->offer_issuer_id)
print_node_id("offer_issuer_id", invreq->offer_issuer_id);
if (invreq->offer_recurrence)
well_formed &= print_recurrance(invreq->offer_recurrence,
invreq->offer_recurrence_paywindow,
@ -885,7 +886,7 @@ int main(int argc, char *argv[])
errx(ERROR_BAD_DECODE, "Bad invoice: %s", fail);
if (invoice->invreq_payer_id) {
if (invoice->offer_node_id) {
if (invoice->offer_issuer_id) {
invoice_offer_id(invoice, &offer_id);
print_hash("offer_id", &offer_id);
}
@ -914,8 +915,8 @@ int main(int argc, char *argv[])
well_formed &= print_utf8("offer_issuer", invoice->offer_issuer);
if (invoice->offer_quantity_max)
print_u64("offer_quantity_max", *invoice->offer_quantity_max);
if (invoice->offer_node_id)
print_node_id("offer_node_id", invoice->offer_node_id);
if (invoice->offer_issuer_id)
print_node_id("offer_issuer_id", invoice->offer_issuer_id);
if (invoice->offer_recurrence)
well_formed &= print_recurrance(invoice->offer_recurrence,
invoice->offer_recurrence_paywindow,

View File

@ -71,8 +71,7 @@
},
"then": {
"required": [
"offer_id",
"offer_node_id"
"offer_id"
],
"additionalProperties": false,
"properties": {
@ -239,7 +238,14 @@
"offer_node_id": {
"type": "pubkey",
"description": [
"Public key of the offering node."
"Obsolete name for offer_issuer_id."
]
},
"offer_issuer_id": {
"type": "pubkey",
"added": "v24.08",
"description": [
"The pubkey associated with the offer (can be a node id)."
]
},
"offer_recurrence": {
@ -411,6 +417,13 @@
"`offer_node_id` is not present."
]
},
"warning_missing_offer_issuer_id": {
"type": "string",
"added": "v24.08",
"description": [
"`offer_issuer_id` is not present and there are no offer_paths"
]
},
"warning_invalid_offer_description": {
"type": "string",
"description": [
@ -457,7 +470,6 @@
},
"then": {
"required": [
"offer_node_id",
"invreq_metadata",
"invreq_payer_id",
"signature"
@ -632,6 +644,13 @@
"Public key of the offering node."
]
},
"offer_issuer_id": {
"type": "pubkey",
"added": "v24.08",
"description": [
"Public key of the offering node (can be a node id)."
]
},
"offer_recurrence": {
"type": "object",
"description": [
@ -854,6 +873,7 @@
"offer_quantity_max": {},
"offer_paths": {},
"offer_node_id": {},
"offer_issuer_id": {},
"offer_recurrence": {},
"invreq_metadata": {},
"invreq_payer_id": {},
@ -940,7 +960,6 @@
},
"then": {
"required": [
"offer_node_id",
"invreq_metadata",
"invreq_payer_id",
"invoice_paths",
@ -1119,6 +1138,13 @@
"Public key of the offering node."
]
},
"offer_issuer_id": {
"type": "pubkey",
"added": "v24.08",
"description": [
"Public key of the offering node (can be a node id)."
]
},
"offer_recurrence": {
"type": "object",
"description": [
@ -1435,7 +1461,7 @@
"invoice_node_id": {
"type": "pubkey",
"description": [
"The id to pay (usually the same as offer_node_id)."
"The id to pay (usually the same as offer_issuer_id)."
]
},
"invoice_recurrence_basetime": {
@ -1447,7 +1473,7 @@
"signature": {
"type": "bip340sig",
"description": [
"BIP-340 signature of the `offer_node_id` on this invoice."
"BIP-340 signature of the `offer_issuer_id` on this invoice."
]
},
"unknown_invoice_tlvs": {
@ -1526,6 +1552,7 @@
"offer_quantity_max": {},
"offer_paths": {},
"offer_node_id": {},
"offer_issuer_id": {},
"offer_recurrence": {},
"invreq_metadata": {},
"invreq_payer_id": {},

View File

@ -1767,7 +1767,7 @@ static struct command_result *json_createinvoice(struct command *cmd,
hsm_sign_b12_invoice(cmd->ld, inv);
b12enc = invoice_encode(cmd, inv);
if (inv->offer_node_id) {
if (inv->offer_issuer_id) {
invoice_offer_id(inv, &offer_id);
if (wallet_offer_find(tmpctx, cmd->ld->wallet,
&offer_id, NULL, &status)) {

View File

@ -765,9 +765,9 @@ static const char *check_bolt12_condition(const tal_t *ctx,
return rune_alt_single_missing(ctx, alt);
return rune_alt_single_int(ctx, alt, *b12->invoice_amount);
case INV_FIELD_NODE_ID: {
if (!b12->offer_node_id)
if (!b12->offer_issuer_id)
return rune_alt_single_missing(ctx, alt);
const char *id = fmt_pubkey(tmpctx, b12->offer_node_id);
const char *id = fmt_pubkey(tmpctx, b12->offer_issuer_id);
return rune_alt_single_str(ctx, alt, id, strlen(id));
}
case INV_FIELD_DESCRIPTION:

View File

@ -217,10 +217,10 @@ static struct command_result *handle_invreq_response(struct command *cmd,
}
/* BOLT-offers #12:
* - if `offer_node_id` is present (invoice_request for an offer):
* - MUST reject the invoice if `invoice_node_id` is not equal to `offer_node_id`.
* - if `offer_issuer_id` is present (invoice_request for an offer):
* - MUST reject the invoice if `invoice_node_id` is not equal to `offer_issuer_id`.
*/
if (!inv->invoice_node_id || !pubkey_eq(inv->offer_node_id, inv->invoice_node_id)) {
if (!inv->invoice_node_id || !pubkey_eq(inv->offer_issuer_id, inv->invoice_node_id)) {
badfield = "invoice_node_id";
goto badinv;
}
@ -788,7 +788,7 @@ struct command_result *json_fetchinvoice(struct command *cmd,
sent->wait_timeout = *timeout;
sent->their_paths = sent->offer->offer_paths;
sent->direct_dest = sent->offer->offer_node_id;
sent->direct_dest = sent->offer->offer_issuer_id;
/* BOLT-offers #12:
* - SHOULD not respond to an offer if the current time is after
@ -1144,13 +1144,13 @@ static struct command_result *param_invreq(struct command *cmd,
/* Plugin handles these automatically, you shouldn't send one
* manually. */
if ((*invreq)->offer_node_id) {
if ((*invreq)->offer_issuer_id) {
return command_fail_badparam(cmd, name, buffer, tok,
"This is based on an offer?");
}
/* BOLT-offers #12:
* - otherwise (no `offer_node_id`, not a response to our offer):
* - otherwise (no `offer_issuer_id`, not a response to our offer):
* - MUST fail the request if any of the following are present:
* - `offer_chains`, `offer_features` or `offer_quantity_max`.
* - MUST fail the request if `invreq_amount` is not present.
@ -1169,7 +1169,7 @@ static struct command_result *param_invreq(struct command *cmd,
"Missing invreq_amount");
/* BOLT-offers #12:
* - otherwise (no `offer_node_id`, not a response to our offer):
* - otherwise (no `offer_issuer_id`, not a response to our offer):
*...
* - MAY use `offer_amount` (or `offer_currency`) for informational display to user.
*/
@ -1259,8 +1259,8 @@ struct command_result *json_sendinvoice(struct command *cmd,
&sent->inv_preimage, sizeof(sent->inv_preimage));
/* BOLT-offers #12:
* - if `offer_node_id` is present:
* - MUST set `invoice_node_id` to `offer_node_id`.
* - if `offer_issuer_id` is present:
* - MUST set `invoice_node_id` to `offer_issuer_id`.
* - otherwise:
* - MUST set `invoice_node_id` to a valid public key.
*/

View File

@ -609,7 +609,7 @@ static bool json_add_offer_fields(struct json_stream *js,
struct blinded_path **offer_paths,
const char *offer_issuer,
const u64 *offer_quantity_max,
const struct pubkey *offer_node_id,
const struct pubkey *offer_issuer_id,
const struct recurrence *offer_recurrence,
const struct recurrence_paywindow *offer_recurrence_paywindow,
const u32 *offer_recurrence_limit,
@ -694,8 +694,8 @@ static bool json_add_offer_fields(struct json_stream *js,
}
/* Required for offers, *not* for others! */
if (offer_node_id)
json_add_pubkey(js, "offer_node_id", offer_node_id);
if (offer_issuer_id)
json_add_pubkey(js, "offer_issuer_id", offer_issuer_id);
return valid;
}
@ -743,17 +743,17 @@ static void json_add_offer(struct json_stream *js, const struct tlv_offer *offer
offer->offer_paths,
offer->offer_issuer,
offer->offer_quantity_max,
offer->offer_node_id,
offer->offer_issuer_id,
offer->offer_recurrence,
offer->offer_recurrence_paywindow,
offer->offer_recurrence_limit,
offer->offer_recurrence_base);
/* BOLT-offers #12:
* - if `offer_node_id` is not set:
* - if `offer_issuer_id` is not set:
* - MUST NOT respond to the offer.
*/
if (!offer->offer_node_id) {
json_add_string(js, "warning_missing_offer_node_id",
if (!offer->offer_issuer_id) {
json_add_string(js, "warning_missing_offer_issuer_id",
"offers without a node_id are invalid");
valid = false;
}
@ -890,8 +890,8 @@ static void json_add_invoice_request(struct json_stream *js,
{
bool valid = true;
/* If there's an offer_node_id, then there's an offer. */
if (invreq->offer_node_id) {
/* If there's an offer_issuer_id, then there's an offer. */
if (invreq->offer_issuer_id) {
struct sha256 offer_id;
invreq_offer_id(invreq, &offer_id);
@ -909,7 +909,7 @@ static void json_add_invoice_request(struct json_stream *js,
invreq->offer_paths,
invreq->offer_issuer,
invreq->offer_quantity_max,
invreq->offer_node_id,
invreq->offer_issuer_id,
invreq->offer_recurrence,
invreq->offer_recurrence_paywindow,
invreq->offer_recurrence_limit,
@ -967,8 +967,8 @@ static void json_add_b12_invoice(struct json_stream *js,
{
bool valid = true;
/* If there's an offer_node_id, then there's an offer. */
if (invoice->offer_node_id) {
/* If there's an offer_issuer_id, then there's an offer. */
if (invoice->offer_issuer_id) {
struct sha256 offer_id;
invoice_offer_id(invoice, &offer_id);
@ -986,7 +986,7 @@ static void json_add_b12_invoice(struct json_stream *js,
invoice->offer_paths,
invoice->offer_issuer,
invoice->offer_quantity_max,
invoice->offer_node_id,
invoice->offer_issuer_id,
invoice->offer_recurrence,
invoice->offer_recurrence_paywindow,
invoice->offer_recurrence_limit,

View File

@ -134,8 +134,8 @@ static struct command_result *listinvreqs_done(struct command *cmd,
*...
* - if the invoice is a response to an `invoice_request`:
* - MUST reject the invoice if all fields in ranges 0 to 159 and 1000000000 to 2999999999 (inclusive) do not exactly match the `invoice_request`.
* - if `offer_node_id` is present (invoice_request for an offer):
* - MUST reject the invoice if `invoice_node_id` is not equal to `offer_node_id`.
* - if `offer_issuer_id` is present (invoice_request for an offer):
* - MUST reject the invoice if `invoice_node_id` is not equal to `offer_issuer_id`.
* - otherwise (invoice_request without an offer):
* - MAY reject the invoice if it cannot confirm that `invoice_node_id` is correct, out-of-band.
*
@ -159,7 +159,7 @@ static struct command_result *listinvreqs_done(struct command *cmd,
return fail_inv(cmd, inv, "invoice_request no longer available");
/* We only save ones without offers to the db! */
assert(!inv->inv->offer_node_id);
assert(!inv->inv->offer_issuer_id);
/* BOLT-offers #12:
* - MUST reject the invoice if `signature` is not a valid signature

View File

@ -930,11 +930,11 @@ static struct command_result *listoffers_done(struct command *cmd,
assert(ir->inv->invreq_payer_id);
/* BOLT-offers #12:
* - if `offer_node_id` is present:
* - MUST set `invoice_node_id` to `offer_node_id`.
* - if `offer_issuer_id` is present:
* - MUST set `invoice_node_id` to `offer_issuer_id`.
*/
/* We always provide an offer_node_id! */
ir->inv->invoice_node_id = ir->inv->offer_node_id;
/* We always provide an offer_issuer_id! */
ir->inv->invoice_node_id = ir->inv->offer_issuer_id;
/* BOLT-offers #12:
* - MUST set `invoice_created_at` to the number of seconds since
@ -1048,16 +1048,16 @@ struct command_result *handle_invoice_request(struct command *cmd,
/* BOLT-offers #12:
*
* - otherwise (no `offer_node_id`, not a response to our offer):
* - otherwise (no `offer_issuer_id`, not a response to our offer):
*/
/* FIXME-OFFERS: handle this! */
if (!ir->invreq->offer_node_id) {
if (!ir->invreq->offer_issuer_id) {
return fail_invreq(cmd, ir, "Not based on an offer");
}
/* BOLT-offers #12:
*
* - if `offer_node_id` is present (response to an offer):
* - if `offer_issuer_id` is present (response to an offer):
* - MUST fail the request if the offer fields do not exactly match a
* valid, unexpired offer.
*/

View File

@ -551,10 +551,10 @@ struct command_result *json_offer(struct command *cmd,
}
/* BOLT-offers #12:
* - MUST set `offer_node_id` to the node's public key to request the
* - MUST set `offer_issuer_id` to the node's public key to request the
* invoice from.
*/
offer->offer_node_id = tal_dup(offer, struct pubkey, &id);
offer->offer_issuer_id = tal_dup(offer, struct pubkey, &id);
/* Now rest of offer will not change: we use pathless offer to create secret. */
if (paths) {
@ -631,9 +631,9 @@ struct command_result *json_invoicerequest(struct command *cmd,
* - otherwise (not responding to an offer):
* - MUST set offer_description to a complete description of the purpose of the payment.
* - MUST set (or not set) offer_absolute_expiry and offer_issuer as it would for an offer.
* - MUST set invreq_payer_id (as it would set offer_node_id for an offer).
* - MUST set invreq_payer_id (as it would set offer_issuer_id for an offer).
* - MUST set invreq_paths as it would set (or not set) offer_paths for an offer.
* - MUST NOT include signature, offer_metadata, offer_chains, offer_amount, offer_currency, offer_features, offer_quantity_max, offer_paths or offer_node_id
* - MUST NOT include signature, offer_metadata, offer_chains, offer_amount, offer_currency, offer_features, offer_quantity_max, offer_paths or offer_issuer_id
* - if the chain for the invoice is not solely bitcoin:
* - MUST pecify invreq_chain the offer is valid for.
* - MUST set invreq_amount.
@ -669,7 +669,7 @@ struct command_result *json_invoicerequest(struct command *cmd,
/* BOLT-offers #12:
* - otherwise (not responding to an offer):
*...
* - MUST set `invreq_payer_id` as it would set `offer_node_id` for an offer.
* - MUST set `invreq_payer_id` as it would set `offer_issuer_id` for an offer.
*/
/* createinvoicerequest sets these! */

View File

@ -18,8 +18,8 @@ tlvtype,offer,offer_issuer,18
tlvdata,offer,offer_issuer,issuer,utf8,...
tlvtype,offer,offer_quantity_max,20
tlvdata,offer,offer_quantity_max,max,tu64,
tlvtype,offer,offer_node_id,22
tlvdata,offer,offer_node_id,node_id,point,
tlvtype,offer,offer_issuer_id,22
tlvdata,offer,offer_issuer_id,id,point,
tlvtype,offer,offer_recurrence,1212121212
tlvdata,offer,offer_recurrence,recurrence,recurrence,
tlvtype,offer,offer_recurrence_paywindow,1212121214
@ -50,8 +50,8 @@ tlvtype,invoice_request,offer_issuer,18
tlvdata,invoice_request,offer_issuer,issuer,utf8,...
tlvtype,invoice_request,offer_quantity_max,20
tlvdata,invoice_request,offer_quantity_max,max,tu64,
tlvtype,invoice_request,offer_node_id,22
tlvdata,invoice_request,offer_node_id,node_id,point,
tlvtype,invoice_request,offer_issuer_id,22
tlvdata,invoice_request,offer_issuer_id,id,point,
tlvtype,invoice_request,offer_recurrence,1212121212
tlvdata,invoice_request,offer_recurrence,recurrence,recurrence,
tlvtype,invoice_request,offer_recurrence_paywindow,1212121214
@ -100,8 +100,8 @@ tlvtype,invoice,offer_issuer,18
tlvdata,invoice,offer_issuer,issuer,utf8,...
tlvtype,invoice,offer_quantity_max,20
tlvdata,invoice,offer_quantity_max,max,tu64,
tlvtype,invoice,offer_node_id,22
tlvdata,invoice,offer_node_id,node_id,point,
tlvtype,invoice,offer_issuer_id,22
tlvdata,invoice,offer_issuer_id,id,point,
tlvtype,invoice,offer_recurrence,1212121212
tlvdata,invoice,offer_recurrence,recurrence,recurrence,
tlvtype,invoice,offer_recurrence_paywindow,1212121214

1 tlvtype,offer,offer_chains,2
18 tlvdata,offer,offer_issuer,issuer,utf8,...
19 tlvtype,offer,offer_quantity_max,20
20 tlvdata,offer,offer_quantity_max,max,tu64,
21 tlvtype,offer,offer_node_id,22 tlvtype,offer,offer_issuer_id,22
22 tlvdata,offer,offer_node_id,node_id,point, tlvdata,offer,offer_issuer_id,id,point,
23 tlvtype,offer,offer_recurrence,1212121212
24 tlvdata,offer,offer_recurrence,recurrence,recurrence,
25 tlvtype,offer,offer_recurrence_paywindow,1212121214
50 tlvdata,invoice_request,offer_issuer,issuer,utf8,...
51 tlvtype,invoice_request,offer_quantity_max,20
52 tlvdata,invoice_request,offer_quantity_max,max,tu64,
53 tlvtype,invoice_request,offer_node_id,22 tlvtype,invoice_request,offer_issuer_id,22
54 tlvdata,invoice_request,offer_node_id,node_id,point, tlvdata,invoice_request,offer_issuer_id,id,point,
55 tlvtype,invoice_request,offer_recurrence,1212121212
56 tlvdata,invoice_request,offer_recurrence,recurrence,recurrence,
57 tlvtype,invoice_request,offer_recurrence_paywindow,1212121214
100 tlvdata,invoice,offer_issuer,issuer,utf8,...
101 tlvtype,invoice,offer_quantity_max,20
102 tlvdata,invoice,offer_quantity_max,max,tu64,
103 tlvtype,invoice,offer_node_id,22 tlvtype,invoice,offer_issuer_id,22
104 tlvdata,invoice,offer_node_id,node_id,point, tlvdata,invoice,offer_issuer_id,id,point,
105 tlvtype,invoice,offer_recurrence,1212121212
106 tlvdata,invoice,offer_recurrence,recurrence,recurrence,
107 tlvtype,invoice,offer_recurrence_paywindow,1212121214

View File

@ -2,8 +2,8 @@
+++ wire/bolt12_wire.csv 2022-10-04 13:25:59.617242667 +1030
@@ -22,6 +22,14 @@
tlvdata,offer,offer_quantity_max,max,tu64,
tlvtype,offer,offer_node_id,24
tlvdata,offer,offer_node_id,node_id,point,
tlvtype,offer,offer_issuer_id,22
tlvdata,offer,offer_issuer_id,id,point,
+tlvtype,offer,offer_recurrence,1212121212
+tlvdata,offer,offer_recurrence,recurrence,recurrence,
+tlvtype,offer,offer_recurrence_paywindow,1212121214
@ -17,8 +17,8 @@
tlvtype,invoice_request,offer_chains,2
@@ -48,6 +60,14 @@
tlvdata,invoice_request,offer_quantity_max,max,tu64,
tlvtype,invoice_request,offer_node_id,24
tlvdata,invoice_request,offer_node_id,node_id,point,
tlvtype,invoice_request,offer_issuer_id,22
tlvdata,invoice_request,offer_issuer_id,id,point,
+tlvtype,invoice_request,offer_recurrence,1212121212
+tlvdata,invoice_request,offer_recurrence,recurrence,recurrence,
+tlvtype,invoice_request,offer_recurrence_paywindow,1212121214
@ -42,8 +42,8 @@
tlvdata,invoice_request,signature,sig,bip340sig,
tlvtype,invoice,invreq_metadata,0
@@ -89,5 +117,13 @@
tlvtype,invoice,offer_node_id,24
tlvdata,invoice,offer_node_id,node_id,point,
tlvtype,invoice,offer_issuer_id,22
tlvdata,invoice,offer_issuer_id,id,point,
+tlvtype,invoice,offer_recurrence,1212121212
+tlvdata,invoice,offer_recurrence,recurrence,recurrence,
+tlvtype,invoice,offer_recurrence_paywindow,1212121214