Skip to content

Commit 91f6d2b

Browse files
committed
rpc/wallet: add conf_target as alias to confTarget in bumpfee
1 parent 69158b4 commit 91f6d2b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,8 +3241,8 @@ static UniValue bumpfee(const JSONRPCRequest& request)
32413241
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid to be bumped"},
32423242
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
32433243
{
3244-
{"confTarget", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
3245-
{"fee_rate", RPCArg::Type::NUM, /* default */ "fall back to 'confTarget'", "fee rate (NOT total fee) to pay, in " + CURRENCY_UNIT + " per kB\n"
3244+
{"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
3245+
{"fee_rate", RPCArg::Type::NUM, /* default */ "fall back to 'conf_target'", "fee rate (NOT total fee) to pay, in " + CURRENCY_UNIT + " per kB\n"
32463246
" Specify a fee rate instead of relying on the built-in fee estimator.\n"
32473247
"Must be at least 0.0001 " + CURRENCY_UNIT + " per kB higher than the current transaction fee rate.\n"},
32483248
{"replaceable", RPCArg::Type::BOOL, /* default */ "true", "Whether the new transaction should still be\n"
@@ -3294,15 +3294,24 @@ static UniValue bumpfee(const JSONRPCRequest& request)
32943294
RPCTypeCheckObj(options,
32953295
{
32963296
{"confTarget", UniValueType(UniValue::VNUM)},
3297+
{"conf_target", UniValueType(UniValue::VNUM)},
32973298
{"fee_rate", UniValueType(UniValue::VNUM)},
32983299
{"replaceable", UniValueType(UniValue::VBOOL)},
32993300
{"estimate_mode", UniValueType(UniValue::VSTR)},
33003301
},
33013302
true, true);
3302-
if (options.exists("confTarget") && options.exists("fee_rate")) {
3303-
throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget can't be set with fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.");
3304-
} else if (options.exists("confTarget")) { // TODO: alias this to conf_target
3305-
coin_control.m_confirm_target = ParseConfirmTarget(options["confTarget"], pwallet->chain().estimateMaxBlocks());
3303+
3304+
if (options.exists("confTarget") && options.exists("conf_target")) {
3305+
throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget and conf_target options should not both be set. Use conf_target (confTarget is deprecated).");
3306+
}
3307+
3308+
auto conf_target = options.exists("confTarget") ? options["confTarget"] : options["conf_target"];
3309+
3310+
if (!conf_target.isNull()) {
3311+
if (options.exists("fee_rate")) {
3312+
throw JSONRPCError(RPC_INVALID_PARAMETER, "conf_target can't be set with fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.");
3313+
}
3314+
coin_control.m_confirm_target = ParseConfirmTarget(conf_target, pwallet->chain().estimateMaxBlocks());
33063315
} else if (options.exists("fee_rate")) {
33073316
CFeeRate fee_rate(AmountFromValue(options["fee_rate"]));
33083317
if (fee_rate <= CFeeRate(0)) {

0 commit comments

Comments
 (0)