lightningd: allow "NNblocks" and "minimum" as feerates.

And consolidate descriptions into lightning-feerates().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `close`, `fundchannel`, `fundpsbt`, `multifundchannel`, `multiwithdraw`, `txprepare`, `upgradewallet`, `withdraw` now allow "minimum" and NN"blocks" as `feerate` (`feerange` for `close`).
This commit is contained in:
Rusty Russell
2023-04-07 14:13:45 +09:30
parent 64b1ddd761
commit c46473e615
13 changed files with 69 additions and 81 deletions

View File

@@ -120,6 +120,25 @@ static struct command_result *param_feerate_unchecked(struct command *cmd,
} else if (json_tok_streq(buffer, tok, "urgent")) {
**feerate = feerate_for_deadline(cmd->ld->topology, 6);
return NULL;
} else if (json_tok_streq(buffer, tok, "minimum")) {
**feerate = get_feerate_floor(cmd->ld->topology);
return NULL;
}
/* Can specify number of blocks as a target */
if (json_tok_endswith(buffer, tok, "blocks")) {
jsmntok_t base = *tok;
base.end -= strlen("blocks");
u32 numblocks;
if (!json_to_number(buffer, &base, &numblocks)) {
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"'%s' should be an integer not '%.*s'",
name, base.end - base.start,
buffer + base.start);
}
**feerate = feerate_for_deadline(cmd->ld->topology, numblocks);
return NULL;
}
/* It's a number... */