plugins/bcli: use per-command deprecation flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2024-01-25 10:58:56 +10:30
parent 5c484cd9e6
commit 5f899d0dd2
3 changed files with 34 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ hidden: false
| 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) |
| 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 |
@@ -37,6 +37,16 @@ hidden: 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 |
| listchannels.include_private | Field(s) | v24.02 | v24.08 | `listchannels` including private channels (now use listpeerchannels which gives far more detail) |
| estimatefees.dummy_null | Field | v23.05 | v24.05 | deprecated feerates are `null` (rather than missing) if fee estimate is not available |
| estimatefees.opening | Field | v23.05 | v24.05 | `opening` feerate (implementation-specific, use modern feerates) |
| estimatefees.mutual_close | Field | v23.05 | v24.05 | `mutual_close` feerate (implementation-specific, use modern feerates) |
| estimatefees.unilateral_close | Field | v23.05 | v24.05 | `unilateral_close` feerate (implementation-specific, use modern feerates) |
| estimatefees.delayed_to_us | Field | v23.05 | v24.05 | `delayed_to_us` feerate (implementation-specific, use modern feerates) |
| estimatefees.htlc_resolution | Field | v23.05 | v24.05 | `htlc_resolution` feerate (implementation-specific, use modern feerates) |
| estimatefees.penalty | Field | v23.05 | v24.05 | `penalty` feerate (implementation-specific, use modern feerates) |
| estimatefees.min_acceptable | Field | v23.05 | v24.05 | `min_acceptable` feerate (implementation-specific, use modern feerates) |
| estimatefees.max_acceptable | Field | v23.05 | v24.05 | `max_acceptable` feerate (implementation-specific, use modern feerates) |
Inevitably there are features which need to change: either to be generalized, or removed when they can no longer be supported.

View File

@@ -485,7 +485,8 @@ estimatefees_null_response(struct bitcoin_cli *bcli)
json_array_end(response);
json_add_u32(response, "feerate_floor", 1000);
if (deprecated_apis) {
if (command_deprecated_out_ok(bcli->cmd, "dummy_null",
"v23.05", "v24.05")) {
json_add_null(response, "opening");
json_add_null(response, "mutual_close");
json_add_null(response, "unilateral_close");
@@ -730,21 +731,34 @@ static struct command_result *estimatefees_next(struct command *cmd,
}
response = jsonrpc_stream_success(cmd);
if (deprecated_apis) {
if (command_deprecated_out_ok(cmd, "opening",
"v23.05", "v24.05"))
json_add_feerate(response, "opening", cmd, stash,
feerate_for_block(stash, 12));
if (command_deprecated_out_ok(cmd, "mutual_close",
"v23.05", "v24.05"))
json_add_feerate(response, "mutual_close", cmd, stash,
feerate_for_block(stash, 100));
if (command_deprecated_out_ok(cmd, "unilateral_close",
"v23.05", "v24.05"))
json_add_feerate(response, "unilateral_close", cmd, stash,
feerate_for_block(stash, 6));
if (command_deprecated_out_ok(cmd, "delayed_to_us",
"v23.05", "v24.05"))
json_add_feerate(response, "delayed_to_us", cmd, stash,
feerate_for_block(stash, 12));
if (command_deprecated_out_ok(cmd, "htlc_resolution",
"v23.05", "v24.05"))
json_add_feerate(response, "htlc_resolution", cmd, stash,
feerate_for_block(stash, 6));
if (command_deprecated_out_ok(cmd, "penalty",
"v23.05", "v24.05"))
json_add_feerate(response, "penalty", cmd, stash,
feerate_for_block(stash, 12));
/* We divide the slow feerate for the minimum acceptable, lightningd
* will use floor if it's hit, though. */
if (command_deprecated_out_ok(cmd, "min_acceptable",
"v23.05", "v24.05"))
json_add_feerate(response, "min_acceptable", cmd, stash,
feerate_for_block(stash, 100) / 2);
/* BOLT #2:
@@ -753,9 +767,10 @@ static struct command_result *estimatefees_next(struct command *cmd,
* spent in the future, it's a good idea for the fee payer to keep a good
* margin (say 5x the expected fee requirement)
*/
if (command_deprecated_out_ok(cmd, "max_acceptable",
"v23.05", "v24.05"))
json_add_feerate(response, "max_acceptable", cmd, stash,
feerate_for_block(stash, 2) * 10);
}
/* Modern style: present an ordered array of block deadlines, and a floor. */
json_array_start(response, "feerates");

View File

@@ -380,20 +380,18 @@ static struct command_result *listpeerchannels_done(struct command *cmd,
struct gossmap *gossmap = get_gossmap();
struct gossmap_localmods *mods;
if (deprecated_apis)
connected = local_connected(opts, buf, result);
else
connected = NULL;
/* In deprecated mode, re-add private channels */
if (deprecated_apis) {
if (command_deprecated_in_ok(cmd, "include_private", "v24.02", "v24.08")) {
connected = local_connected(opts, buf, result);
mods = gossmods_from_listpeerchannels(tmpctx, &local_id,
buf, result,
gossmod_add_unknown_localchan,
gossmap);
gossmap_apply_localmods(gossmap, mods);
} else
} else {
connected = NULL;
mods = NULL;
}
js = jsonrpc_stream_success(cmd);
json_array_start(js, "channels");