diff --git a/doc/lightning-disableoffer.7.md b/doc/lightning-disableoffer.7.md index 2af2c73060b6..d074eb9582fc 100644 --- a/doc/lightning-disableoffer.7.md +++ b/doc/lightning-disableoffer.7.md @@ -41,7 +41,6 @@ On success, an object is returned, containing: - **active** (boolean): Whether the offer can produce invoices/payments (always *false*) - **single\_use** (boolean): Whether the offer is disabled after first successful use - **bolt12** (string): The bolt12 string representing this offer -- **bolt12\_unsigned** (string): The bolt12 string representing this offer, without signature - **used** (boolean): Whether the offer has had an invoice paid / payment made - **label** (string, optional): The label provided when offer was created @@ -75,4 +74,4 @@ RESOURCES --------- Main web site: -[comment]: # ( SHA256STAMP:27200ba49d493cbbb1ea84736ccfaeb05a92c69dab34f48cd3d5bbf46ffc2d64) +[comment]: # ( SHA256STAMP:b471374a7c160373b328c2171953225b7fa27d26314a270e95320c1b6ef57307) diff --git a/doc/lightning-listoffers.7.md b/doc/lightning-listoffers.7.md index 1852270a2106..6df61df145b5 100644 --- a/doc/lightning-listoffers.7.md +++ b/doc/lightning-listoffers.7.md @@ -36,7 +36,6 @@ On success, an object containing **offers** is returned. It is an array of obje - **active** (boolean): whether this can still be used - **single\_use** (boolean): whether this expires as soon as it's paid - **bolt12** (string): the bolt12 encoding of the offer -- **bolt12\_unsigned** (string): the bolt12 encoding of the offer, without signature - **used** (boolean): True if an associated invoice has been paid - **label** (string, optional): the (optional) user-specified label @@ -81,4 +80,4 @@ RESOURCES --------- Main web site: -[comment]: # ( SHA256STAMP:ac5b79c1f9b76add7eb08b9940180f2200049509df627cccc1dc892efa488778) +[comment]: # ( SHA256STAMP:985a6bae4b0a1702cd02998859c8072eee44b219c15294af4f4078465531c8c9) diff --git a/doc/lightning-offer.7.md b/doc/lightning-offer.7.md index 26e689b923ba..b9ebd5736ade 100644 --- a/doc/lightning-offer.7.md +++ b/doc/lightning-offer.7.md @@ -101,7 +101,6 @@ On success, an object is returned, containing: - **active** (boolean): whether this can still be used (always *true*) - **single\_use** (boolean): whether this expires as soon as it's paid (reflects the *single_use* parameter) - **bolt12** (string): the bolt12 encoding of the offer -- **bolt12\_unsigned** (string): the bolt12 encoding of the offer, without a signature - **used** (boolean): True if an associated invoice has been paid - **created** (boolean): false if the offer already existed - **label** (string, optional): the (optional) user-specified label @@ -135,4 +134,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:aa7544c07d3d84963e43500a367ceb62ebab8f5ae26de1dd39bb087f928dcaee) +[comment]: # ( SHA256STAMP:217af2aae777229992e2ee07c6f8040d4ca5b75ee2064590584de13162974fe2) diff --git a/doc/lightning-offerout.7.md b/doc/lightning-offerout.7.md index 968a0ffa39cf..6eb010487111 100644 --- a/doc/lightning-offerout.7.md +++ b/doc/lightning-offerout.7.md @@ -60,7 +60,6 @@ On success, an object is returned, containing: - **active** (boolean): whether this will pay a matching incoming invoice (always *true*) - **single\_use** (boolean): whether this expires as soon as it's paid out (always *true*) - **bolt12** (string): the bolt12 encoding of the offer -- **bolt12\_unsigned** (string): the bolt12 encoding of the offer, without a signature - **used** (boolean): True if an incoming invoice has been paid (always *false*) - **created** (boolean): false if the offer already existed - **label** (string, optional): the (optional) user-specified label @@ -100,4 +99,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:7c0f75ca64bdcce2467f42d7671caccf5f7bf6eb97fb3edef1e39f2fdb87b4d8) +[comment]: # ( SHA256STAMP:903e40a51c806613da956ce1b4021e9aac964c11d0d0c2714aeb68a12f083265) diff --git a/doc/schemas/disableoffer.schema.json b/doc/schemas/disableoffer.schema.json index 8b7331bf5de4..ccb64d27388d 100644 --- a/doc/schemas/disableoffer.schema.json +++ b/doc/schemas/disableoffer.schema.json @@ -6,7 +6,6 @@ "active", "single_use", "bolt12", - "bolt12_unsigned", "used" ], "additionalProperties": false, @@ -32,10 +31,6 @@ "type": "string", "description": "The bolt12 string representing this offer" }, - "bolt12_unsigned": { - "type": "string", - "description": "The bolt12 string representing this offer, without signature" - }, "used": { "type": "boolean", "description": "Whether the offer has had an invoice paid / payment made" diff --git a/doc/schemas/listoffers.schema.json b/doc/schemas/listoffers.schema.json index 9f5be747da54..a97287c38ca3 100644 --- a/doc/schemas/listoffers.schema.json +++ b/doc/schemas/listoffers.schema.json @@ -16,7 +16,6 @@ "active", "single_use", "bolt12", - "bolt12_unsigned", "used" ], "properties": { @@ -38,10 +37,6 @@ "type": "string", "description": "the bolt12 encoding of the offer" }, - "bolt12_unsigned": { - "type": "string", - "description": "the bolt12 encoding of the offer, without signature" - }, "used": { "type": "boolean", "description": "True if an associated invoice has been paid" diff --git a/doc/schemas/offer.schema.json b/doc/schemas/offer.schema.json index b57c306ed8ee..fc21a80d3c97 100644 --- a/doc/schemas/offer.schema.json +++ b/doc/schemas/offer.schema.json @@ -7,7 +7,6 @@ "active", "single_use", "bolt12", - "bolt12_unsigned", "used", "created" ], @@ -33,10 +32,6 @@ "type": "string", "description": "the bolt12 encoding of the offer" }, - "bolt12_unsigned": { - "type": "string", - "description": "the bolt12 encoding of the offer, without a signature" - }, "used": { "type": "boolean", "description": "True if an associated invoice has been paid" diff --git a/doc/schemas/offerout.schema.json b/doc/schemas/offerout.schema.json index 12f7972cc20c..e0874e094357 100644 --- a/doc/schemas/offerout.schema.json +++ b/doc/schemas/offerout.schema.json @@ -7,7 +7,6 @@ "active", "single_use", "bolt12", - "bolt12_unsigned", "used", "created" ], @@ -36,10 +35,6 @@ "type": "string", "description": "the bolt12 encoding of the offer" }, - "bolt12_unsigned": { - "type": "string", - "description": "the bolt12 encoding of the offer, without a signature" - }, "used": { "type": "boolean", "enum": [ diff --git a/lightningd/offer.c b/lightningd/offer.c index 4c8e221e0dca..c12f472aa9e6 100644 --- a/lightningd/offer.c +++ b/lightningd/offer.c @@ -19,7 +19,6 @@ static void json_populate_offer(struct json_stream *response, const struct sha256 *offer_id, const char *b12, - const char *b12_nosig, const struct json_escape *label, enum offer_status status) { @@ -27,8 +26,6 @@ static void json_populate_offer(struct json_stream *response, json_add_bool(response, "active", offer_status_active(status)); json_add_bool(response, "single_use", offer_status_single(status)); json_add_string(response, "bolt12", b12); - if (b12_nosig) - json_add_string(response, "bolt12_unsigned", b12_nosig); json_add_bool(response, "used", offer_status_used(status)); if (label) json_add_escaped_string(response, "label", label); @@ -90,10 +87,9 @@ static struct command_result *json_createoffer(struct command *cmd, struct json_escape *label; struct tlv_offer *offer; struct sha256 merkle; - const char *b12str, *b12str_nosig; + const char *b12str; bool *single_use; enum offer_status status; - struct pubkey key; bool created; if (!param(cmd, buffer, params, @@ -108,11 +104,7 @@ static struct command_result *json_createoffer(struct command *cmd, else status = OFFER_MULTIPLE_USE_UNUSED; merkle_tlv(offer->fields, &merkle); - offer->signature = tal(offer, struct bip340sig); - if (!pubkey_from_node_id(&key, &cmd->ld->id)) - fatal("invalid own node_id?"); - hsm_sign_b12(cmd->ld, "offer", "signature", &merkle, NULL, &key, - offer->signature); + offer->signature = NULL; b12str = offer_encode(cmd, offer); /* If it already exists, we use that one instead (and then @@ -131,10 +123,9 @@ static struct command_result *json_createoffer(struct command *cmd, created = true; offer->signature = tal_free(offer->signature); - b12str_nosig = offer_encode(cmd, offer); response = json_stream_success(cmd); - json_populate_offer(response, &merkle, b12str, b12str_nosig, label, status); + json_populate_offer(response, &merkle, b12str, label, status); json_add_bool(response, "created", created); return command_success(cmd, response); } @@ -147,25 +138,6 @@ static const struct json_command createoffer_command = { }; AUTODATA(json_command, &createoffer_command); -/* We store strings in the db, so removing signatures is easiest by conversion */ -static const char *offer_str_nosig(const tal_t *ctx, - struct lightningd *ld, - const char *b12str) -{ - char *fail; - struct tlv_offer *offer = offer_decode(tmpctx, b12str, strlen(b12str), - ld->our_features, chainparams, - &fail); - - if (!offer) { - log_broken(ld->log, "Cannot reparse offerstr from db %s: %s", - b12str, fail); - return NULL; - } - offer->signature = tal_free(offer->signature); - return offer_encode(ctx, offer); -} - static struct command_result *json_listoffers(struct command *cmd, const char *buffer, const jsmntok_t *obj UNNEEDED, @@ -194,7 +166,6 @@ static struct command_result *json_listoffers(struct command *cmd, json_object_start(response, NULL); json_populate_offer(response, offer_id, b12, - offer_str_nosig(tmpctx, cmd->ld, b12), label, status); json_object_end(response); } @@ -211,8 +182,6 @@ static struct command_result *json_listoffers(struct command *cmd, json_object_start(response, NULL); json_populate_offer(response, &id, b12, - offer_str_nosig(tmpctx, - cmd->ld, b12), label, status); json_object_end(response); } @@ -258,10 +227,7 @@ static struct command_result *json_disableoffer(struct command *cmd, status = wallet_offer_disable(wallet, offer_id, status); response = json_stream_success(cmd); - json_populate_offer(response, offer_id, b12, - offer_str_nosig(tmpctx, - cmd->ld, b12), - label, status); + json_populate_offer(response, offer_id, b12, label, status); return command_success(cmd, response); } diff --git a/tests/test_pay.py b/tests/test_pay.py index 3ed145d57a19..ca1d67ae6fb4 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -4405,7 +4405,6 @@ def test_offer(node_factory, bitcoind): offer = only_one(l1.rpc.call('listoffers', [ret['offer_id']])['offers']) assert offer['bolt12'] == ret['bolt12'] - assert offer['bolt12_unsigned'] == ret['bolt12_unsigned'] assert offer['offer_id'] == ret['offer_id'] output = subprocess.check_output([bolt12tool, 'decode', @@ -4414,12 +4413,6 @@ def test_offer(node_factory, bitcoind): assert 'amount' not in output else: assert 'amount' in output - output = subprocess.check_output([bolt12tool, 'decode', - offer['bolt12_unsigned']]).decode('ASCII') - if amount == 'any': - assert 'amount' not in output - else: - assert 'amount' in output # Try wrong amount precision: with pytest.raises(RpcError, match='Currency AUD requires 2 minor units'): @@ -4608,7 +4601,7 @@ def test_fetchinvoice(node_factory, bitcoind): assert offer1['created'] is True inv1 = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12']}) - inv2 = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12_unsigned'], + inv2 = l1.rpc.call('fetchinvoice', {'offer': offer1['bolt12'], 'payer_note': 'Thanks for the fish!'}) assert inv1 != inv2 assert 'next_period' not in inv1 @@ -4908,7 +4901,7 @@ def test_sendinvoice(node_factory, bitcoind): assert only_one(l1.rpc.call('listoffers', [offer['offer_id']])['offers'])['used'] is False # sendinvoice should work. - out = l2.rpc.call('sendinvoice', {'offer': offer['bolt12_unsigned'], + out = l2.rpc.call('sendinvoice', {'offer': offer['bolt12'], 'label': 'test sendinvoice 1'}) assert out['label'] == 'test sendinvoice 1' assert out['description'] == 'simple test'