diff --git a/doc/lightning-listconfigs.7.md b/doc/lightning-listconfigs.7.md index 184083134..d6f65b128 100644 --- a/doc/lightning-listconfigs.7.md +++ b/doc/lightning-listconfigs.7.md @@ -97,7 +97,8 @@ On success, an object is returned, containing: - **log-timestamps** (boolean, optional): `log-timestamps` field from config or cmdline, or default - **force-feerates** (string, optional): force-feerate configuration setting, if any - **subdaemon** (string, optional): `subdaemon` fields from config or cmdline if any (can be more than one) -- **fetchinvoice-noconnect** (boolean, optional): `featchinvoice-noconnect` fileds from config or cmdline, or default +- **fetchinvoice-noconnect** (boolean, optional): `fetchinvoice-noconnect` fields from config or cmdline, or default +- **accept-htlc-tlv-types** (string, optional): `accept-extra-tlvs-type` fields from config or cmdline, or not present - **tor-service-password** (string, optional): `tor-service-password` field from config or cmdline, if any - **dev-allowdustreserve** (boolean, optional): Whether we allow setting dust reserves @@ -217,5 +218,4 @@ RESOURCES --------- Main web site: - -[comment]: # ( SHA256STAMP:310cc00ef62e7075d5d2588b0492c2dd96f507cc739f67d56ccc6c4f3135bca5) +[comment]: # ( SHA256STAMP:5871ac751654339ed65ab905d61f0bc3afbb8576a33a5c4e9a73d2084f438582) diff --git a/doc/lightningd-config.5.md b/doc/lightningd-config.5.md index 6a07cd143..40815c875 100644 --- a/doc/lightningd-config.5.md +++ b/doc/lightningd-config.5.md @@ -424,6 +424,12 @@ the outgoing is redeemed. might need to redeem this on-chain, so this is the number of blocks we have to do that. +* **accept-htlc-tlv-types**=*types* + + Normally HTLC onions which contain unknown even fields are rejected. +This option specifies that these (comma-separated) types are to be +accepted, and ignored. + ### Invoice control options: * **autocleaninvoice-cycle**=*SECONDS* [plugin `autoclean`] diff --git a/doc/schemas/listconfigs.schema.json b/doc/schemas/listconfigs.schema.json index db1d451e0..4377c4cea 100644 --- a/doc/schemas/listconfigs.schema.json +++ b/doc/schemas/listconfigs.schema.json @@ -281,7 +281,11 @@ }, "fetchinvoice-noconnect": { "type": "boolean", - "description": "`featchinvoice-noconnect` fileds from config or cmdline, or default" + "description": "`fetchinvoice-noconnect` fields from config or cmdline, or default" + }, + "accept-htlc-tlv-types": { + "type": "string", + "description": "`accept-extra-tlvs-type` fields from config or cmdline, or not present" }, "tor-service-password": { "type": "string", diff --git a/doc/undoc-flags.json b/doc/undoc-flags.json index ef8b8fe23..5f1822cea 100644 --- a/doc/undoc-flags.json +++ b/doc/undoc-flags.json @@ -1,6 +1,5 @@ { "flags": [ - "experimental-accept-extra-tlv-types", "channel-fee-max-base-msat", "channel-fee-max-proportional-thousandths", "funder-fund-probability", @@ -18,4 +17,4 @@ "lease-fee-basis", "lease-funding-weight" ] -} \ No newline at end of file +} diff --git a/lightningd/options.c b/lightningd/options.c index c40f371d7..37845da18 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -171,11 +171,10 @@ static char *fmt_force_feerates(const tal_t *ctx, const u32 *force_feerates) return ret; } -#if EXPERIMENTAL_FEATURES static char *opt_set_accept_extra_tlv_types(const char *arg, - struct lightningd *ld) + struct lightningd *ld) { - char *endp, **elements = tal_strsplit(NULL, arg, ",", STR_NO_EMPTY);; + char *endp, **elements = tal_strsplit(NULL, arg, ",", STR_NO_EMPTY); unsigned long long l; u64 u; for (int i = 0; elements[i] != NULL; i++) { @@ -193,7 +192,6 @@ static char *opt_set_accept_extra_tlv_types(const char *arg, tal_free(elements); return NULL; } -#endif /* Returns the number of wireaddr types already announced */ static size_t num_announced_types(enum wire_addr_type type, struct lightningd *ld) @@ -1182,11 +1180,9 @@ static void register_opts(struct lightningd *ld) &ld->tor_service_password, "Set a Tor hidden service password"); -#if EXPERIMENTAL_FEATURES - opt_register_arg("--experimental-accept-extra-tlv-types", + opt_register_arg("--accept-htlc-tlv-types", opt_set_accept_extra_tlv_types, NULL, ld, - "Comma separated list of extra TLV types to accept."); -#endif + "Comma separated list of extra HTLC TLV types to accept."); opt_register_early_noarg("--disable-dns", opt_set_invbool, &ld->config.use_dns, "Disable DNS lookups of peers"); @@ -1509,7 +1505,7 @@ static void add_config(struct lightningd *ld, const char *name, size_t len) { char *name0 = tal_strndup(tmpctx, name, len); - const char *answer = NULL; + char *answer = NULL; char buf[OPT_SHOW_LEN + sizeof("...")]; #if DEVELOPER @@ -1605,7 +1601,7 @@ static void add_config(struct lightningd *ld, if (ld->rgb) answer = tal_hexstr(name0, ld->rgb, 3); } else if (opt->cb_arg == (void *)opt_set_alias) { - answer = (const char *)ld->alias; + answer = (char *)ld->alias; } else if (opt->cb_arg == (void *)arg_log_to_file) { if (ld->logfiles) json_add_opt_log_to_files(response, name0, ld->logfiles); @@ -1668,10 +1664,17 @@ static void add_config(struct lightningd *ld, fmt_amount_msat(tmpctx, *(struct amount_msat *) opt->u.carg)); -#if EXPERIMENTAL_FEATURES } else if (opt->cb_arg == (void *)opt_set_accept_extra_tlv_types) { - /* TODO Actually print the option */ -#endif + for (size_t i = 0; + i < tal_count(ld->accept_extra_tlv_types); + i++) { + if (i == 0) + answer = tal_fmt(name0, "%"PRIu64, + ld->accept_extra_tlv_types[i]); + else + tal_append_fmt(&answer, ",%"PRIu64, + ld->accept_extra_tlv_types[i]); + } #if DEVELOPER } else if (strstarts(name, "dev-")) { /* Ignore dev settings */ diff --git a/tests/test_pay.py b/tests/test_pay.py index 5b74135a2..ea54a9eb5 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -3568,7 +3568,6 @@ def test_keysend(node_factory): l3.rpc.keysend(l4.info['id'], amt) -@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Requires experimental-accept-extra-tlv-types option") def test_keysend_extra_tlvs(node_factory): """Use the extratlvs option to deliver a message with sphinx' TLV type. """ @@ -3577,14 +3576,21 @@ def test_keysend_extra_tlvs(node_factory): 2, wait_for_announce=True, opts=[ - {}, { - 'experimental-accept-extra-tlv-types': '133773310', + # Not needed, just for listconfigs test. + 'accept-htlc-tlv-types': '133773310,99990', + }, + { + 'accept-htlc-tlv-types': '133773310', "plugin": os.path.join(os.path.dirname(__file__), "plugins/sphinx-receiver.py"), }, ] ) + # Make sure listconfigs works here + assert l1.rpc.listconfigs()['accept-htlc-tlv-types'] == '133773310,99990' + assert l2.rpc.listconfigs()['accept-htlc-tlv-types'] == '133773310' + l1.rpc.keysend(l2.info['id'], amt, extratlvs={133773310: 'FEEDC0DE'}) inv = only_one(l2.rpc.listinvoices()['invoices']) assert(l2.daemon.is_in_log(r'plugin-sphinx-receiver.py.*extratlvs.*133773310.*feedc0de'))