Skip to content

Commit

Permalink
bcli: remove deprecated estimatefees responses.
Browse files Browse the repository at this point in the history
Changelog-Removed: Plugins: `estimatefees` returning feerates by name (e.g. "opening"); deprecated in v23.05.
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 14, 2024
1 parent ba69007 commit fc2f1f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 73 deletions.
9 changes: 0 additions & 9 deletions doc/developers-guide/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ 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) |
| 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) |
| offer.recurrence_base.at_prefix | Parameter | v24.02 | v24.05 | `recurrence_base` with `@` prefix (use `recurrence_start_any_period`) |
| max-locktime-blocks | Config | v24.05 | v24.11 | --max-locktime-blocks is now set to 2016 in the BOLT 4 spec |

Expand Down
65 changes: 1 addition & 64 deletions plugins/bcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,6 @@ estimatefees_null_response(struct bitcoin_cli *bcli)
json_array_end(response);
json_add_u32(response, "feerate_floor", 1000);

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");
json_add_null(response, "delayed_to_us");
json_add_null(response, "htlc_resolution");
json_add_null(response, "penalty");
json_add_null(response, "min_acceptable");
json_add_null(response, "max_acceptable");
}

return command_finished(bcli->cmd, response);
}

Expand Down Expand Up @@ -844,16 +832,6 @@ static void json_add_feerate(struct json_stream *result, const char *fieldname,
}
}

static u32 feerate_for_block(const struct estimatefees_stash *stash, u32 blocks)
{
for (size_t i = 0; i < ARRAY_SIZE(stash->perkb); i++) {
if (estimatefee_params[i].blocks != blocks)
continue;
return stash->perkb[i];
}
abort();
}

static struct command_result *estimatefees_next(struct command *cmd,
struct estimatefees_stash *stash)
{
Expand All @@ -872,48 +850,7 @@ static struct command_result *estimatefees_next(struct command *cmd,
}

response = jsonrpc_stream_success(cmd);
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:
*
* Given the variance in fees, and the fact that the transaction may be
* 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. */
/* Present an ordered array of block deadlines, and a floor. */
json_array_start(response, "feerates");
for (size_t i = 0; i < ARRAY_SIZE(stash->perkb); i++) {
if (!stash->perkb[i])
Expand Down

0 comments on commit fc2f1f4

Please sign in to comment.