From 136d0c8005ed56d9a36a91656bb00d8f3b4a86f4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 10 Sep 2022 11:35:31 +0930 Subject: [PATCH] offers: update to remove "vendor" and "timestamp" fields. Changelog-EXPERIMENTAL: remove "vendor" (use "issuer") and "timestamp" (use "created_at") fields (deprecated v0.10.2). --- plugins/offers.c | 17 ++------------ plugins/offers_offer.c | 50 ------------------------------------------ 2 files changed, 2 insertions(+), 65 deletions(-) diff --git a/plugins/offers.c b/plugins/offers.c index a1495bd2f..5fd2cf11d 100644 --- a/plugins/offers.c +++ b/plugins/offers.c @@ -412,14 +412,9 @@ static void json_add_offer(struct json_stream *js, const struct tlv_offer *offer valid = false; } - if (offer->issuer) { + if (offer->issuer) json_add_stringn(js, "issuer", offer->issuer, tal_bytelen(offer->issuer)); - if (deprecated_apis) { - json_add_stringn(js, "vendor", offer->issuer, - tal_bytelen(offer->issuer)); - } - } if (offer->features) json_add_hex_talarr(js, "features", offer->features); if (offer->absolute_expiry) @@ -579,14 +574,9 @@ static void json_add_b12_invoice(struct json_stream *js, valid = false; } - if (invoice->issuer) { + if (invoice->issuer) json_add_stringn(js, "issuer", invoice->issuer, tal_bytelen(invoice->issuer)); - if (deprecated_apis) { - json_add_stringn(js, "vendor", invoice->issuer, - tal_bytelen(invoice->issuer)); - } - } if (invoice->features) json_add_hex_talarr(js, "features", invoice->features); if (invoice->paths) { @@ -644,9 +634,6 @@ static void json_add_b12_invoice(struct json_stream *js, * - MUST reject the invoice if `created_at` is not present. */ if (invoice->created_at) { - /* FIXME: Remove soon! */ - if (deprecated_apis) - json_add_u64(js, "timestamp", *invoice->created_at); json_add_u64(js, "created_at", *invoice->created_at); } else { json_add_string(js, "warning_invoice_missing_created_at", diff --git a/plugins/offers_offer.c b/plugins/offers_offer.c index ee0968830..520513dad 100644 --- a/plugins/offers_offer.c +++ b/plugins/offers_offer.c @@ -322,36 +322,6 @@ struct command_result *json_offer(struct command *cmd, offinfo->offer = offer = tlv_offer_new(offinfo); - /* "issuer" used to be called "vendor" */ - if (deprecated_apis - && params - && params->type == JSMN_OBJECT - && json_get_member(buffer, params, "vendor")) { - if (!param(cmd, buffer, params, - p_req("amount", param_amount, offer), - p_req("description", param_escaped_string, &desc), - p_opt("vendor", param_escaped_string, &issuer), - p_opt("label", param_escaped_string, &offinfo->label), - p_opt("quantity_min", param_u64, &offer->quantity_min), - p_opt("quantity_max", param_u64, &offer->quantity_max), - p_opt("absolute_expiry", param_u64, &offer->absolute_expiry), - p_opt("recurrence", param_recurrence, &offer->recurrence), - p_opt("recurrence_base", - param_recurrence_base, - &offer->recurrence_base), - p_opt("recurrence_paywindow", - param_recurrence_paywindow, - &offer->recurrence_paywindow), - p_opt("recurrence_limit", - param_number, - &offer->recurrence_limit), - p_opt_def("single_use", param_bool, - &offinfo->single_use, false), - NULL)) - return command_param_failed(); - goto after_params; - } - if (!param(cmd, buffer, params, p_req("amount", param_amount, offer), p_req("description", param_escaped_string, &desc), @@ -376,7 +346,6 @@ struct command_result *json_offer(struct command *cmd, NULL)) return command_param_failed(); -after_params: if (!offers_enabled) return command_fail(cmd, LIGHTNINGD, "experimental-offers not enabled"); @@ -466,24 +435,6 @@ struct command_result *json_offerout(struct command *cmd, offer = tlv_offer_new(cmd); - /* "issuer" used to be called "vendor" */ - if (deprecated_apis - && params - && params->type == JSMN_OBJECT - && json_get_member(buffer, params, "vendor")) { - if (!param(cmd, buffer, params, - p_req("amount", param_msat_or_any, offer), - p_req("description", param_escaped_string, &desc), - p_opt("vendor", param_escaped_string, &issuer), - p_opt("label", param_escaped_string, &label), - p_opt("absolute_expiry", param_u64, &offer->absolute_expiry), - p_opt("refund_for", param_invoice_payment_hash, &offer->refund_for), - /* FIXME: hints support! */ - NULL)) - return command_param_failed(); - goto after_params; - } - if (!param(cmd, buffer, params, p_req("amount", param_msat_or_any, offer), p_req("description", param_escaped_string, &desc), @@ -495,7 +446,6 @@ struct command_result *json_offerout(struct command *cmd, NULL)) return command_param_failed(); -after_params: if (!offers_enabled) return command_fail(cmd, LIGHTNINGD, "experimental-offers not enabled");