mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
lightningd: mark all internal deprecations by version.
I did some CHANGELOG and git digging to see when these were deprecated, and some were very old (v0.8.2!). But since they didn't warn users loudly, I chose to do so this release only. I renamed ld's `deprecated_apis` to `deprecated_ok` to make sure I caught them all. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
5a6c529c69
commit
50e7c71dc7
@ -5,12 +5,38 @@ excerpt: "Deprecated features and timeline for old feature removals."
|
||||
hidden: false
|
||||
---
|
||||
|
||||
| Name | Type | First Deprecated | Last Supported | Description |
|
||||
|-----------------------------|---------|------------------|----------------|-------------------------------------------------------------------------------|
|
||||
| delexpiredinvoice | Command | v22.11 | v24.02 | `autoclean-once` is more powerful |
|
||||
| autocleaninvoice | Command | v22.11 | v24.02 | `autoclean` is more general, does more than expired invoices |
|
||||
| autocleaninvoice-cycle | Config | v22.11 | v24.02 | Now always once per hour: you can run `autoclean-once` regularly if you need. |
|
||||
| autocleaninvoice-expired-by | Config | v22.11 | v24.02 | `autoclean`'s `autoclean-expiredinvoices-age` |
|
||||
| Name | Type | First Deprecated | Last Supported | Description |
|
||||
|--------------------------------------|--------------------|------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| delexpiredinvoice | Command | v22.11 | v24.02 | `autoclean-once` is more powerful |
|
||||
| autocleaninvoice | Command | v22.11 | v24.02 | `autoclean` is more general, does more than expired invoices |
|
||||
| autocleaninvoice-cycle | Config | v22.11 | v24.02 | Now always once per hour: you can run `autoclean-once` regularly if you need. |
|
||||
| autocleaninvoice-expired-by | Config | v22.11 | v24.02 | `autoclean`'s `autoclean-expiredinvoices-age` |
|
||||
| feerates.delayed_to_us | Field | v23.05 | v24.02 | Not used with anchor outputs. |
|
||||
| feerates.htlc_resolution | Field | v23.05 | v24.02 | Not used with anchor outputs. |
|
||||
| listconfigs.configlist | Fields | v23.08 | v24.08 | Instead of direct members with names equal the config variable, there's now a `configs` sub-object containing a member with details of each config setting |
|
||||
| feerate.NAME | Parameters | v23.05 | v23.05 | Internal (unstable) parameters ("opening", "mutual_close", "delayed_to_us", "htlc_resolution", "penalty", "min_acceptable", "max_acceptable": use new-style names or `N`blocks. |
|
||||
| invoice_payment_hook.failure_code | Hook Return | v22.08 | v23.02 | Plugins should generate a complete `failure_message` for better control |
|
||||
| htlc_Accepted_hook.failure_code | Hook Return | v0.8 | v23.02 | Plugins should generate a complete `failure_message` for better control |
|
||||
| connection_notification.rawfields | Notification Field | v23.08 | v24.08 | All notifications now wrap members in an object of the same name |
|
||||
| disconnection_notification.rawfields | Notification Field | v23.08 | v24.08 | All notifications now wrap members in an object of the same name |
|
||||
| channel_opened.funding_locked | Notification Field | v22.11 | v24.02 | Renamed to `channel_ready`, as per spec change (zero conf channels are ready before locked) |
|
||||
| block_added_notification.block | Notification Field | v23.08 | v24.08 | All notifications now wrap members in an object of the same name |
|
||||
| accept-htlc-tlv-types | Config | v23.08 | v24.08 | New `accept-htlc-tlv-type` can be specified multiple times, which is cleaner |
|
||||
| bind-addr.torv3 | Config | v23.08 | v24.08 | `announce-addr` makes more sense for Tor addresses |
|
||||
| addr.torv3 | Config | v23.08 | v24.08 | `announce-addr` makes more sense for Tor addresses |
|
||||
| addr.socket | Config | v23.08 | v24.08 | `bind-addr` makes more sense for local sockets since we cannot announce them |
|
||||
| experimental-websocket-port | Config | v23.08 | v23.08 | Use `bind=ws:` to specify websocket ports on a per-port basis |
|
||||
| announce-addr-dns | Config | v23.08 | v24.08 | Use `bind-addr=dns:` to specify DNS announcements on a per-address basis |
|
||||
| rest-port.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-port` to `clnrest-port` (added in v23.11) |
|
||||
| rest-protocol.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-protocol` to `clnrest-protocol` (added in v23.11) |
|
||||
| rest-host.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-host` to `clnrest-host` (added in v23.11) |
|
||||
| rest-certs.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-certs` to `clnrest-certs` (added in v23.11) |
|
||||
| sendpay.channel.ignored | Parameter | v0.12 | v24.02 | Ignore channel specified in first hop and simply use peer id and select our own channel. |
|
||||
| listpeers.channels | Field | v23.02 | v24.02 | Channels are now in `listpeerchannels` |
|
||||
| ....0-or-1 | Config | v23.08 | v24.08 | Boolean options (in plugins only) used to accept `0` or `1` in place of `true` or `false` |
|
||||
| options.flag.default-not-false | Getmanifest Reply | v23.08 | v24.08 | `flag` options with a default which is not `false` (would be meaningless, since user can only set it to `true` |
|
||||
| plugin.nonumericids | Getmanifest Reply | v23.08 | v24.08 | Plugins must specify that they can accept non-numeric command ids (numeric ids are deprecated) |
|
||||
| createrune.restrictions.string | Parameter | v23.05 | v24.02 | `restrictions` parameter must be an array of arrays, not an array of strings |
|
||||
|
||||
Inevitably there are features which need to change: either to be generalized, or removed when they can no longer be supported.
|
||||
|
||||
|
@ -310,10 +310,16 @@ static void estimatefees_callback(const char *buf, const jsmntok_t *toks,
|
||||
"feerates"),
|
||||
&floor);
|
||||
} else {
|
||||
if (!call->bitcoind->ld->deprecated_apis)
|
||||
if (!lightningd_deprecated_in_ok(call->bitcoind->ld,
|
||||
call->bitcoind->ld->log,
|
||||
call->bitcoind->ld->deprecated_ok,
|
||||
"estimatefeesv1", NULL,
|
||||
"v23.05", "v24.05",
|
||||
NULL)) {
|
||||
bitcoin_plugin_error(call->bitcoind, buf, resulttok,
|
||||
"estimatefees",
|
||||
"missing fee_floor field");
|
||||
"missing feerate_floor field");
|
||||
}
|
||||
|
||||
feerates = parse_deprecated_feerates(call, call->bitcoind,
|
||||
buf, resulttok);
|
||||
|
@ -706,11 +706,13 @@ static struct command_result *json_feerates(struct command *cmd,
|
||||
if (rate)
|
||||
json_add_num(response, "penalty",
|
||||
feerate_to_style(rate, *style));
|
||||
if (cmd->ld->deprecated_apis) {
|
||||
if (command_deprecated_out_ok(cmd, "delayed_to_us", "v23.05", "v24.02")) {
|
||||
rate = delayed_to_us_feerate(topo);
|
||||
if (rate)
|
||||
json_add_num(response, "delayed_to_us",
|
||||
feerate_to_style(rate, *style));
|
||||
}
|
||||
if (command_deprecated_out_ok(cmd, "htlc_resolution", "v23.05", "v24.02")) {
|
||||
rate = htlc_resolution_feerate(topo);
|
||||
if (rate)
|
||||
json_add_num(response, "htlc_resolution",
|
||||
|
@ -271,7 +271,7 @@ static struct command_result *json_listconfigs(struct command *cmd,
|
||||
|
||||
response = json_stream_success(cmd);
|
||||
|
||||
if (!cmd->ld->deprecated_apis)
|
||||
if (!command_deprecated_out_ok(cmd, "configlist", "v23.08", "v24.08"))
|
||||
goto modern;
|
||||
|
||||
if (!config)
|
||||
|
@ -733,7 +733,7 @@ int connectd_init(struct lightningd *ld)
|
||||
ld->config.connection_timeout_secs,
|
||||
websocket_helper_path,
|
||||
ld->websocket_port,
|
||||
!ld->deprecated_apis,
|
||||
!ld->deprecated_ok,
|
||||
ld->dev_fast_gossip,
|
||||
ld->dev_disconnect_fd >= 0,
|
||||
ld->dev_no_ping_timer);
|
||||
|
@ -82,9 +82,10 @@ static struct command_result *param_feerate_unchecked(struct command *cmd,
|
||||
|
||||
if (!json_tok_streq(buffer, tok, feerate_name(i)))
|
||||
continue;
|
||||
if (!cmd->ld->deprecated_apis)
|
||||
if (!command_deprecated_in_ok(cmd, feerate_name(i), "v23.05", "v23.05")) {
|
||||
return command_fail_badparam(cmd, name, buffer, tok,
|
||||
"removed feerate by names");
|
||||
}
|
||||
switch (i) {
|
||||
case FEERATE_OPENING:
|
||||
case FEERATE_MUTUAL_CLOSE:
|
||||
|
@ -273,9 +273,6 @@ static const u8 *hook_gives_failmsg(const tal_t *ctx,
|
||||
return failmsg;
|
||||
}
|
||||
|
||||
if (!ld->deprecated_apis)
|
||||
return NULL;
|
||||
|
||||
t = json_get_member(buffer, toks, "failure_code");
|
||||
if (!t) {
|
||||
static bool warned = false;
|
||||
@ -292,6 +289,12 @@ static const u8 *hook_gives_failmsg(const tal_t *ctx,
|
||||
return failmsg_incorrect_or_unknown(ctx, ld, hin);
|
||||
}
|
||||
|
||||
if (!lightningd_deprecated_in_ok(ld, ld->log,
|
||||
ld->deprecated_ok,
|
||||
"invoice_payment_hook", "failure_code",
|
||||
"v22.08", "V23.02", NULL))
|
||||
return NULL;
|
||||
|
||||
if (!json_to_number(buffer, t, &val))
|
||||
fatal("Invalid invoice_payment_hook failure_code: %.*s",
|
||||
toks[0].end - toks[1].start, buffer);
|
||||
|
@ -665,7 +665,7 @@ static bool command_deprecated_ok(const struct command *cmd)
|
||||
{
|
||||
if (cmd->jcon)
|
||||
return cmd->jcon->deprecated_ok;
|
||||
return cmd->ld->deprecated_apis;
|
||||
return cmd->ld->deprecated_ok;
|
||||
}
|
||||
|
||||
bool command_deprecated_in_ok(struct command *cmd,
|
||||
@ -1349,7 +1349,7 @@ static struct io_plan *jcon_connected(struct io_conn *conn,
|
||||
jcon->input_toks = toks_alloc(jcon);
|
||||
jcon->notifications_enabled = false;
|
||||
jcon->db_batching = false;
|
||||
jcon->deprecated_ok = ld->deprecated_apis;
|
||||
jcon->deprecated_ok = ld->deprecated_ok;
|
||||
list_head_init(&jcon->commands);
|
||||
|
||||
/* We want to log on destruction, so we free this in destructor. */
|
||||
|
@ -268,7 +268,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
|
||||
ld->pure_tor_setup = false;
|
||||
ld->tor_service_password = NULL;
|
||||
ld->websocket_port = 0;
|
||||
ld->deprecated_apis = true;
|
||||
ld->deprecated_ok = true;
|
||||
|
||||
/*~ This is initialized later, but the plugin loop examines this,
|
||||
* so set it to NULL explicitly now. */
|
||||
|
@ -111,7 +111,7 @@ struct lightningd {
|
||||
const char *daemon_dir;
|
||||
|
||||
/* Are deprecated APIs enabled? */
|
||||
bool deprecated_apis;
|
||||
bool deprecated_ok;
|
||||
|
||||
/* If we told to run in the background, this is our parent fd, otherwise
|
||||
* -1. */
|
||||
|
@ -72,8 +72,11 @@ static void connect_notification_serialize(struct json_stream *stream,
|
||||
const struct wireaddr_internal *addr)
|
||||
{
|
||||
/* Old style: Add raw fields without connect key */
|
||||
if (ld->deprecated_apis)
|
||||
if (lightningd_deprecated_out_ok(ld, ld->deprecated_ok,
|
||||
"connect_notification", "rawfields",
|
||||
"v23.08", "v24.08")) {
|
||||
json_add_connect_fields(stream, nodeid, incoming, addr);
|
||||
}
|
||||
json_object_start(stream, "connect");
|
||||
json_add_connect_fields(stream, nodeid, incoming, addr);
|
||||
json_object_end(stream);
|
||||
@ -104,8 +107,11 @@ static void disconnect_notification_serialize(struct json_stream *stream,
|
||||
const struct node_id *nodeid)
|
||||
{
|
||||
/* Old style: Add raw fields without disconnect key */
|
||||
if (ld->deprecated_apis)
|
||||
if (lightningd_deprecated_out_ok(ld, ld->deprecated_ok,
|
||||
"disconnect_notification", "rawfields",
|
||||
"v23.08", "v24.08")) {
|
||||
json_add_disconnect_fields(stream, nodeid);
|
||||
}
|
||||
json_object_start(stream, "disconnect");
|
||||
json_add_disconnect_fields(stream, nodeid);
|
||||
json_object_end(stream);
|
||||
@ -232,7 +238,8 @@ static void channel_opened_notification_serialize(struct json_stream *stream,
|
||||
json_add_node_id(stream, "id", node_id);
|
||||
json_add_amount_sat_msat(stream, "funding_msat", *funding_sat);
|
||||
json_add_txid(stream, "funding_txid", funding_txid);
|
||||
if (ld->deprecated_apis)
|
||||
if (lightningd_deprecated_out_ok(ld, ld->deprecated_ok,
|
||||
"channel_opened", "funding_locked", "v22.11", "v24.02"))
|
||||
json_add_bool(stream, "funding_locked", channel_ready);
|
||||
json_add_bool(stream, "channel_ready", channel_ready);
|
||||
}
|
||||
@ -535,7 +542,9 @@ static void block_added_notification_serialize(struct json_stream *stream,
|
||||
struct lightningd *ld,
|
||||
const struct block *block)
|
||||
{
|
||||
if (ld->deprecated_apis) {
|
||||
if (lightningd_deprecated_out_ok(ld, ld->deprecated_ok,
|
||||
"block_added_notification", "block",
|
||||
"v23.08", "v24.08")) {
|
||||
json_object_start(stream, "block");
|
||||
json_add_block_added_fields(stream, block);
|
||||
json_object_end(stream);
|
||||
|
@ -39,6 +39,19 @@
|
||||
#define TIME_FROM_MSEC(msec) \
|
||||
{ { .tv_nsec = ((msec) % 1000) * 1000000, .tv_sec = (msec) / 1000 } }
|
||||
|
||||
/* issue is NULL, or what the issue is with the argname */
|
||||
static bool opt_deprecated_ok(struct lightningd *ld,
|
||||
const char *argname,
|
||||
const char *issue,
|
||||
const char *start,
|
||||
const char *end)
|
||||
{
|
||||
return lightningd_deprecated_in_ok(ld, ld->log,
|
||||
ld->deprecated_ok,
|
||||
argname, issue,
|
||||
start, end, NULL);
|
||||
}
|
||||
|
||||
static char *opt_set_u64(const char *arg, u64 *u)
|
||||
{
|
||||
char *endp;
|
||||
@ -211,8 +224,10 @@ static char *opt_set_accept_extra_tlv_types(const char *arg,
|
||||
{
|
||||
char *ret, **elements = tal_strsplit(tmpctx, arg, ",", STR_NO_EMPTY);
|
||||
|
||||
if (!ld->deprecated_apis)
|
||||
if (!opt_deprecated_ok(ld, "accept-htlc-tlv-types", NULL,
|
||||
"v23.08", "v24.08")) {
|
||||
return "Please use --accept-htlc-tlv-type multiple times";
|
||||
}
|
||||
for (int i = 0; elements[i] != NULL; i++) {
|
||||
ret = opt_add_accept_htlc_tlv(elements[i],
|
||||
&ld->accept_extra_tlv_types);
|
||||
@ -280,7 +295,8 @@ static char *opt_add_addr_withtype(const char *arg,
|
||||
case ADDR_TYPE_TOR_V3:
|
||||
switch (ala) {
|
||||
case ADDR_LISTEN:
|
||||
if (!ld->deprecated_apis)
|
||||
if (!opt_deprecated_ok(ld, "bind-addr", "torv3",
|
||||
"v23.08", "v24.08"))
|
||||
return tal_fmt(tmpctx,
|
||||
"Don't use --bind-addr=%s, use --announce-addr=%s",
|
||||
arg, arg);
|
||||
@ -292,7 +308,8 @@ static char *opt_add_addr_withtype(const char *arg,
|
||||
/* And we ignore it */
|
||||
return NULL;
|
||||
case ADDR_LISTEN_AND_ANNOUNCE:
|
||||
if (!ld->deprecated_apis)
|
||||
if (!opt_deprecated_ok(ld, "addr", "torv3",
|
||||
"v23.08", "v24.08"))
|
||||
return tal_fmt(tmpctx,
|
||||
"Don't use --addr=%s, use --announce-addr=%s",
|
||||
arg, arg);
|
||||
@ -337,7 +354,8 @@ static char *opt_add_addr_withtype(const char *arg,
|
||||
return tal_fmt(tmpctx,
|
||||
"Cannot announce sockets, try --bind-addr=%s", arg);
|
||||
case ADDR_LISTEN_AND_ANNOUNCE:
|
||||
if (!ld->deprecated_apis)
|
||||
if (!opt_deprecated_ok(ld, "addr", "socket",
|
||||
"v23.08", "v24.08"))
|
||||
return tal_fmt(tmpctx, "Don't use --addr=%s, use --bind-addr=%s",
|
||||
arg, arg);
|
||||
ala = ADDR_LISTEN;
|
||||
@ -1161,7 +1179,8 @@ static char *opt_set_websocket_port(const char *arg, struct lightningd *ld)
|
||||
u32 port COMPILER_WANTS_INIT("9.3.0 -O2");
|
||||
char *err;
|
||||
|
||||
if (!ld->deprecated_apis)
|
||||
if (!opt_deprecated_ok(ld, "experimental-websocket-port", NULL,
|
||||
"v23.08", "v23.08"))
|
||||
return "--experimental-websocket-port been deprecated, use --bind-addr=ws:...";
|
||||
|
||||
err = opt_set_u32(arg, &port);
|
||||
@ -1262,7 +1281,8 @@ static char *opt_add_api_beg(const char *arg, struct lightningd *ld)
|
||||
|
||||
static char *opt_set_announce_dns(const char *optarg, struct lightningd *ld)
|
||||
{
|
||||
if (!ld->deprecated_apis)
|
||||
if (!opt_deprecated_ok(ld, "announce-addr-dns", NULL,
|
||||
"v23.08", "v24.08"))
|
||||
return "--announce-addr-dns has been deprecated, use --bind-addr=dns:...";
|
||||
return opt_set_bool_arg(optarg, &ld->announce_dns);
|
||||
}
|
||||
@ -1367,7 +1387,7 @@ static void register_opts(struct lightningd *ld)
|
||||
clnopt_witharg("--allow-deprecated-apis",
|
||||
OPT_EARLY|OPT_SHOWBOOL,
|
||||
opt_set_bool_arg, opt_show_bool,
|
||||
&ld->deprecated_apis,
|
||||
&ld->deprecated_ok,
|
||||
"Enable deprecated options, JSONRPC commands, fields, etc.");
|
||||
/* Register plugins as an early args, so we can initialize them and have
|
||||
* them register more command line options */
|
||||
@ -1797,7 +1817,7 @@ void handle_early_opts(struct lightningd *ld, int argc, char *argv[])
|
||||
|
||||
/* --developer changes default for APIs */
|
||||
if (ld->developer)
|
||||
ld->deprecated_apis = false;
|
||||
ld->deprecated_ok = false;
|
||||
|
||||
/*~ We move files from old locations on first upgrade. */
|
||||
promote_missing_files(ld);
|
||||
@ -1840,6 +1860,12 @@ static void fixup_clnrest_options(struct lightningd *ld)
|
||||
/* Did some (plugin) claim it? */
|
||||
if (opt_find_long(cv->configline, &cv->optarg))
|
||||
continue;
|
||||
if (!opt_deprecated_ok(ld,
|
||||
tal_strndup(tmpctx, cv->configline,
|
||||
strcspn(cv->configline, "=")),
|
||||
"clnrest-prefix",
|
||||
"v23.11", "v24.11"))
|
||||
continue;
|
||||
log_unusual(ld->log, "Option %s deprecated in v23.11, renaming to cln%s",
|
||||
cv->configline, cv->configline);
|
||||
prefix_cln(&cv->configline);
|
||||
@ -1848,8 +1874,7 @@ static void fixup_clnrest_options(struct lightningd *ld)
|
||||
|
||||
void handle_opts(struct lightningd *ld)
|
||||
{
|
||||
if (ld->deprecated_apis)
|
||||
fixup_clnrest_options(ld);
|
||||
fixup_clnrest_options(ld);
|
||||
|
||||
/* Now we know all the options, finish parsing and finish
|
||||
* populating ld->configvars with cmdline. */
|
||||
|
@ -801,7 +801,9 @@ static struct command_result *check_invoice_request_usage(struct command *cmd,
|
||||
}
|
||||
|
||||
static struct channel *
|
||||
find_channel_for_htlc_add(struct lightningd *ld, const struct node_id *node,
|
||||
find_channel_for_htlc_add(struct lightningd *ld,
|
||||
struct command *cmd,
|
||||
const struct node_id *node,
|
||||
const struct short_channel_id *scid_or_alias,
|
||||
const struct amount_msat *amount)
|
||||
{
|
||||
@ -822,8 +824,11 @@ find_channel_for_htlc_add(struct lightningd *ld, const struct node_id *node,
|
||||
}
|
||||
|
||||
/* We used to ignore scid: now all-zero means "any" */
|
||||
if (!channel && (ld->deprecated_apis ||
|
||||
memeqzero(scid_or_alias, sizeof(*scid_or_alias)))) {
|
||||
if (!channel
|
||||
&& (memeqzero(scid_or_alias, sizeof(*scid_or_alias))
|
||||
|| command_deprecated_in_ok(cmd,
|
||||
"channel.ignored",
|
||||
"v0.12", "v24.02"))) {
|
||||
list_for_each(&peer->channels, channel, list) {
|
||||
if (channel_state_can_add_htlc(channel->state) &&
|
||||
amount_msat_greater(channel->our_msat, *amount)) {
|
||||
@ -1073,7 +1078,7 @@ send_payment_core(struct lightningd *ld,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
channel = find_channel_for_htlc_add(ld, &first_hop->node_id,
|
||||
channel = find_channel_for_htlc_add(ld, cmd, &first_hop->node_id,
|
||||
&first_hop->scid, &msat);
|
||||
if (!channel) {
|
||||
struct json_stream *data
|
||||
|
@ -2116,7 +2116,8 @@ static void json_add_peer(struct lightningd *ld,
|
||||
/* Note: If !PEER_CONNECTED, peer may use different features on reconnect */
|
||||
json_add_hex_talarr(response, "features", p->their_features);
|
||||
|
||||
if (ld->deprecated_apis) {
|
||||
if (lightningd_deprecated_out_ok(ld, ld->deprecated_ok,
|
||||
"listpeers", "channels", "v23.02", "v24.02")) {
|
||||
json_array_start(response, "channels");
|
||||
json_add_uncommitted_channel(response, p->uncommitted_channel, NULL);
|
||||
|
||||
|
@ -1020,9 +1020,11 @@ static bool htlc_accepted_hook_deserialize(struct htlc_accepted_hook_payload *re
|
||||
buffer + failmsgtok->start);
|
||||
local_fail_in_htlc(hin, take(failmsg));
|
||||
return false;
|
||||
} else if (ld->deprecated_apis
|
||||
&& (failcodetok = json_get_member(buffer, toks,
|
||||
"failure_code"))) {
|
||||
} else if ((failcodetok = json_get_member(buffer, toks,
|
||||
"failure_code"))
|
||||
&& lightningd_deprecated_in_ok(ld, ld->log, ld->deprecated_ok,
|
||||
"htlc_accepted_hook", "failure_code",
|
||||
"v0.8", "v24.02", NULL)) {
|
||||
unsigned int failcode;
|
||||
if (!json_to_number(buffer, failcodetok, &failcode))
|
||||
fatal("Bad failure_code for htlc_accepted"
|
||||
|
@ -906,7 +906,7 @@ static char *plugin_opt_check(struct plugin_opt *popt)
|
||||
/* Fail if this is deprecated */
|
||||
if (!lightningd_deprecated_in_ok(popt->plugin->plugins->ld,
|
||||
popt->plugin->plugins->log,
|
||||
popt->plugin->plugins->ld->deprecated_apis,
|
||||
popt->plugin->plugins->ld->deprecated_ok,
|
||||
popt->plugin->shortname,
|
||||
popt->name,
|
||||
popt->depr_start,
|
||||
@ -918,7 +918,7 @@ static char *plugin_opt_check(struct plugin_opt *popt)
|
||||
static bool plugin_opt_deprecated_out_ok(struct plugin_opt *popt)
|
||||
{
|
||||
return lightningd_deprecated_out_ok(popt->plugin->plugins->ld,
|
||||
popt->plugin->plugins->ld->deprecated_apis,
|
||||
popt->plugin->plugins->ld->deprecated_ok,
|
||||
popt->plugin->shortname,
|
||||
/* Skip --prefix */
|
||||
popt->name + 2,
|
||||
@ -945,8 +945,12 @@ static char *plugin_opt_bool_check(const char *arg, struct plugin_opt *popt)
|
||||
{
|
||||
/* FIXME: For some reason, '1' and '0' were allowed here? */
|
||||
if (streq(arg, "1") || streq(arg, "0")) {
|
||||
if (!popt->plugin->plugins->ld->deprecated_apis)
|
||||
struct lightningd *ld = popt->plugin->plugins->ld;
|
||||
if (!lightningd_deprecated_in_ok(ld, ld->log, ld->deprecated_ok,
|
||||
popt->name + 2, "0-or-1",
|
||||
"v23.08", "v24.08", NULL)) {
|
||||
return "boolean plugin arguments must be true or false";
|
||||
}
|
||||
} else {
|
||||
bool v;
|
||||
char *ret = opt_set_bool_arg(arg, &v);
|
||||
@ -1067,6 +1071,7 @@ static const char *plugin_opt_add(struct plugin *plugin, const char *buffer,
|
||||
const char *name, *err;
|
||||
enum opt_type optflags = 0;
|
||||
bool set;
|
||||
struct lightningd *ld = plugin->plugins->ld;
|
||||
|
||||
nametok = json_get_member(buffer, opt, "name");
|
||||
typetok = json_get_member(buffer, opt, "type");
|
||||
@ -1128,17 +1133,14 @@ static const char *plugin_opt_add(struct plugin *plugin, const char *buffer,
|
||||
/* We used to allow (ignore) anything, now make sure it's 'false' */
|
||||
if (!json_to_bool(buffer, defaulttok, &val)
|
||||
|| val != false) {
|
||||
if (!plugin->plugins->ld->deprecated_apis)
|
||||
if (!lightningd_deprecated_in_ok(ld, plugin->log,
|
||||
ld->deprecated_ok,
|
||||
"options.flag", "default-not-false",
|
||||
"v23.08", "v24.08", NULL)) {
|
||||
return tal_fmt(plugin, "%s type flag default must be 'false' not %.*s",
|
||||
popt->name,
|
||||
json_tok_full_len(defaulttok),
|
||||
json_tok_full(buffer, defaulttok));
|
||||
else {
|
||||
/* At least warn that we're ignoring! */
|
||||
log_broken(plugin->log, "Ignoring default %.*s for %s (if set, must be 'false'!)",
|
||||
json_tok_full_len(defaulttok),
|
||||
json_tok_full(buffer, defaulttok),
|
||||
popt->name);
|
||||
}
|
||||
}
|
||||
defaulttok = NULL;
|
||||
@ -1679,6 +1681,7 @@ static const char *plugin_parse_getmanifest_response(const char *buffer,
|
||||
{
|
||||
const jsmntok_t *resulttok, *featurestok, *custommsgtok, *tok;
|
||||
const char *err;
|
||||
struct lightningd *ld = plugin->plugins->ld;
|
||||
|
||||
*disabled = NULL;
|
||||
|
||||
@ -1743,7 +1746,7 @@ static const char *plugin_parse_getmanifest_response(const char *buffer,
|
||||
buffer + featurestok->start);
|
||||
}
|
||||
|
||||
if (!feature_set_or(plugin->plugins->ld->our_features, fset)) {
|
||||
if (!feature_set_or(ld->our_features, fset)) {
|
||||
return tal_fmt(plugin,
|
||||
"Custom featurebits already present");
|
||||
}
|
||||
@ -1775,13 +1778,19 @@ static const char *plugin_parse_getmanifest_response(const char *buffer,
|
||||
"Invalid nonnumericids: %.*s",
|
||||
json_tok_full_len(tok),
|
||||
json_tok_full(buffer, tok));
|
||||
if (!plugin->plugins->ld->deprecated_apis
|
||||
&& !plugin->non_numeric_ids)
|
||||
if (!plugin->non_numeric_ids
|
||||
&& !lightningd_deprecated_in_ok(ld, ld->log, ld->deprecated_ok,
|
||||
"plugin", "nonnumericids",
|
||||
"v23.08", "v24.08", NULL)) {
|
||||
return tal_fmt(plugin,
|
||||
"Plugin does not allow nonnumericids");
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
/* Default is false in deprecated mode */
|
||||
plugin->non_numeric_ids = !plugin->plugins->ld->deprecated_apis;
|
||||
plugin->non_numeric_ids = !lightningd_deprecated_out_ok(ld, ld->deprecated_ok,
|
||||
"plugin", "nonnumericids",
|
||||
"v23.08", "v24.08");
|
||||
}
|
||||
|
||||
err = plugin_notifications_add(buffer, resulttok, plugin);
|
||||
if (!err)
|
||||
@ -1986,7 +1995,7 @@ const char *plugin_send_getmanifest(struct plugin *p, const char *cmd_id)
|
||||
req = jsonrpc_request_start(p, "getmanifest", cmd_id, p->non_numeric_ids,
|
||||
p->log, NULL, plugin_manifest_cb, p);
|
||||
json_add_bool(req->stream, "allow-deprecated-apis",
|
||||
p->plugins->ld->deprecated_apis);
|
||||
p->plugins->ld->deprecated_ok);
|
||||
jsonrpc_request_end(req);
|
||||
plugin_request_send(p, req);
|
||||
p->plugin_state = AWAITING_GETMANIFEST_RESPONSE;
|
||||
|
@ -475,7 +475,7 @@ static struct rune_altern *rune_altern_from_json(const tal_t *ctx,
|
||||
}
|
||||
|
||||
static struct rune_restr *rune_restr_from_json(struct command *cmd,
|
||||
const tal_t *ctx,
|
||||
const tal_t *ctx,
|
||||
const char *buffer,
|
||||
const jsmntok_t *tok)
|
||||
{
|
||||
@ -484,7 +484,9 @@ static struct rune_restr *rune_restr_from_json(struct command *cmd,
|
||||
struct rune_restr *restr;
|
||||
|
||||
/* \| is not valid JSON, so they use \\|: undo it! */
|
||||
if (cmd->ld->deprecated_apis && tok->type == JSMN_STRING) {
|
||||
if (tok->type == JSMN_STRING
|
||||
&& command_deprecated_in_ok(cmd, "restrictions.string",
|
||||
"v23.05", "v24.02")) {
|
||||
const char *unescape;
|
||||
struct json_escape *e = json_escape_string_(tmpctx,
|
||||
buffer + tok->start,
|
||||
|
@ -655,6 +655,24 @@ struct jsonrpc_request *jsonrpc_request_start_(
|
||||
void kill_uncommitted_channel(struct uncommitted_channel *uc UNNEEDED,
|
||||
const char *why UNNEEDED)
|
||||
{ fprintf(stderr, "kill_uncommitted_channel called!\n"); abort(); }
|
||||
/* Generated stub for lightningd_deprecated_in_ok */
|
||||
bool lightningd_deprecated_in_ok(struct lightningd *ld UNNEEDED,
|
||||
struct logger *log UNNEEDED,
|
||||
bool deprecated_apis UNNEEDED,
|
||||
const char *subsys UNNEEDED,
|
||||
const char *api UNNEEDED,
|
||||
const char *start UNNEEDED,
|
||||
const char *end UNNEEDED,
|
||||
const char *details UNNEEDED)
|
||||
{ fprintf(stderr, "lightningd_deprecated_in_ok called!\n"); abort(); }
|
||||
/* Generated stub for lightningd_deprecated_out_ok */
|
||||
bool lightningd_deprecated_out_ok(struct lightningd *ld UNNEEDED,
|
||||
bool deprecated_apis UNNEEDED,
|
||||
const char *subsys UNNEEDED,
|
||||
const char *api UNNEEDED,
|
||||
const char *start UNNEEDED,
|
||||
const char *end UNNEEDED)
|
||||
{ fprintf(stderr, "lightningd_deprecated_out_ok called!\n"); abort(); }
|
||||
/* Generated stub for lockin_complete */
|
||||
void lockin_complete(struct channel *channel UNNEEDED,
|
||||
enum channel_state expected_state UNNEEDED)
|
||||
|
@ -109,6 +109,12 @@ struct command_result *command_check_done(struct command *cmd)
|
||||
/* Generated stub for command_check_only */
|
||||
bool command_check_only(const struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "command_check_only called!\n"); abort(); }
|
||||
/* Generated stub for command_deprecated_in_ok */
|
||||
bool command_deprecated_in_ok(struct command *cmd UNNEEDED,
|
||||
const char *param UNNEEDED,
|
||||
const char *depr_start UNNEEDED,
|
||||
const char *depr_end UNNEEDED)
|
||||
{ fprintf(stderr, "command_deprecated_in_ok called!\n"); abort(); }
|
||||
/* Generated stub for command_fail */
|
||||
struct command_result *command_fail(struct command *cmd UNNEEDED, enum jsonrpc_errcode code UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
@ -549,6 +555,24 @@ bool json_tok_streq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||
void kill_uncommitted_channel(struct uncommitted_channel *uc UNNEEDED,
|
||||
const char *why UNNEEDED)
|
||||
{ fprintf(stderr, "kill_uncommitted_channel called!\n"); abort(); }
|
||||
/* Generated stub for lightningd_deprecated_in_ok */
|
||||
bool lightningd_deprecated_in_ok(struct lightningd *ld UNNEEDED,
|
||||
struct logger *log UNNEEDED,
|
||||
bool deprecated_apis UNNEEDED,
|
||||
const char *subsys UNNEEDED,
|
||||
const char *api UNNEEDED,
|
||||
const char *start UNNEEDED,
|
||||
const char *end UNNEEDED,
|
||||
const char *details UNNEEDED)
|
||||
{ fprintf(stderr, "lightningd_deprecated_in_ok called!\n"); abort(); }
|
||||
/* Generated stub for lightningd_deprecated_out_ok */
|
||||
bool lightningd_deprecated_out_ok(struct lightningd *ld UNNEEDED,
|
||||
bool deprecated_apis UNNEEDED,
|
||||
const char *subsys UNNEEDED,
|
||||
const char *api UNNEEDED,
|
||||
const char *start UNNEEDED,
|
||||
const char *end UNNEEDED)
|
||||
{ fprintf(stderr, "lightningd_deprecated_out_ok called!\n"); abort(); }
|
||||
/* Generated stub for lockin_complete */
|
||||
void lockin_complete(struct channel *channel UNNEEDED,
|
||||
enum channel_state expected_state UNNEEDED)
|
||||
|
Loading…
Reference in New Issue
Block a user