Skip to content

Commit

Permalink
lightningd: mark all internal deprecations by version.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rustyrussell committed Jan 26, 2024
1 parent 5a6c529 commit 50e7c71
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 59 deletions.
38 changes: 32 additions & 6 deletions doc/developers-guide/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 8 additions & 2 deletions lightningd/bitcoind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lightningd/configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lightningd/connect_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion lightningd/feerate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 6 additions & 3 deletions lightningd/invoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lightningd/jsonrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion lightningd/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion lightningd/lightningd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
17 changes: 13 additions & 4 deletions lightningd/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 50e7c71

Please sign in to comment.