Skip to content

Commit e347cfa

Browse files
committed
rpc: remove deprecated totalFee arg from RPC bumpfee
1 parent bd05f96 commit e347cfa

File tree

3 files changed

+11
-33
lines changed

3 files changed

+11
-33
lines changed

src/wallet/feebumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static feebumper::Result PreconditionChecks(const CWallet& wallet, const CWallet
6060
static feebumper::Result CheckFeeRate(const CWallet& wallet, const CWalletTx& wtx, const CFeeRate& newFeerate, const int64_t maxTxSize, std::vector<std::string>& errors) {
6161
// check that fee rate is higher than mempool's minimum fee
6262
// (no point in bumping fee if we know that the new tx won't be accepted to the mempool)
63-
// This may occur if the user set FeeRate, TotalFee or paytxfee too low, if fallbackfee is too low, or, perhaps,
63+
// This may occur if the user set fee_rate or paytxfee too low, if fallbackfee is too low, or, perhaps,
6464
// in a rare situation where the mempool minimum fee increased significantly since the fee estimation just a
6565
// moment earlier. In this case, we report an error to the user, who may adjust the fee.
6666
CFeeRate minMempoolFeeRate = wallet.chain().mempoolMinFee();

src/wallet/rpcwallet.cpp

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,24 +3342,19 @@ static UniValue bumpfee(const JSONRPCRequest& request)
33423342
"\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n"
33433343
"An opt-in RBF transaction with the given txid must be in the wallet.\n"
33443344
"The command will pay the additional fee by reducing change outputs or adding inputs when necessary. It may add a new change output if one does not already exist.\n"
3345-
"If `totalFee` (DEPRECATED) is given, adding inputs is not supported, so there must be a single change output that is big enough or it will fail.\n"
33463345
"All inputs in the original transaction will be included in the replacement transaction.\n"
33473346
"The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n"
33483347
"By default, the new fee will be calculated automatically using estimatesmartfee.\n"
33493348
"The user can specify a confirmation target for estimatesmartfee.\n"
3350-
"Alternatively, the user can specify totalFee (DEPRECATED), or fee_rate (" + CURRENCY_UNIT + " per kB) for the new transaction .\n"
3349+
"Alternatively, the user can specify a fee_rate (" + CURRENCY_UNIT + " per kB) for the new transaction.\n"
33513350
"At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n"
33523351
"returned by getnetworkinfo) to enter the node's mempool.\n",
33533352
{
33543353
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid to be bumped"},
33553354
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
33563355
{
33573356
{"confTarget", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
3358-
{"totalFee", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "Total fee (NOT feerate) to pay, in satoshis. (DEPRECATED)\n"
3359-
" In rare cases, the actual fee paid might be slightly higher than the specified\n"
3360-
" totalFee if the tx change output has to be removed because it is too close to\n"
3361-
" the dust threshold."},
3362-
{"fee_rate", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "FeeRate (NOT total fee) to pay, in " + CURRENCY_UNIT + " per kB\n"
3357+
{"fee_rate", RPCArg::Type::NUM, /* default */ "fall back to 'confTarget'", "fee rate (NOT total fee) to pay, in " + CURRENCY_UNIT + " per kB\n"
33633358
" Specify a fee rate instead of relying on the built-in fee estimator.\n"
33643359
" Must be at least 0.0001 BTC per kB higher than the current transaction fee rate.\n"},
33653360
{"replaceable", RPCArg::Type::BOOL, /* default */ "true", "Whether the new transaction should still be\n"
@@ -3400,34 +3395,22 @@ static UniValue bumpfee(const JSONRPCRequest& request)
34003395
CCoinControl coin_control;
34013396
coin_control.fAllowWatchOnly = pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
34023397
// optional parameters
3403-
CAmount totalFee = 0;
34043398
coin_control.m_signal_bip125_rbf = true;
34053399

34063400
if (!request.params[1].isNull()) {
34073401
UniValue options = request.params[1];
34083402
RPCTypeCheckObj(options,
34093403
{
34103404
{"confTarget", UniValueType(UniValue::VNUM)},
3411-
{"totalFee", UniValueType(UniValue::VNUM)},
34123405
{"fee_rate", UniValueType(UniValue::VNUM)},
34133406
{"replaceable", UniValueType(UniValue::VBOOL)},
34143407
{"estimate_mode", UniValueType(UniValue::VSTR)},
34153408
},
34163409
true, true);
3417-
if (options.exists("confTarget") && (options.exists("totalFee") || options.exists("fee_rate"))) {
3418-
throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget can't be set with totalFee or fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.");
3419-
} else if (options.exists("fee_rate") && options.exists("totalFee")) {
3420-
throw JSONRPCError(RPC_INVALID_PARAMETER, "fee_rate can't be set along with totalFee.");
3410+
if (options.exists("confTarget") && options.exists("fee_rate")) {
3411+
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.");
34213412
} else if (options.exists("confTarget")) { // TODO: alias this to conf_target
34223413
coin_control.m_confirm_target = ParseConfirmTarget(options["confTarget"], pwallet->chain().estimateMaxBlocks());
3423-
} else if (options.exists("totalFee")) {
3424-
if (!pwallet->chain().rpcEnableDeprecated("totalFee")) {
3425-
throw JSONRPCError(RPC_INVALID_PARAMETER, "totalFee argument has been deprecated and will be removed in 0.20. Please use -deprecatedrpc=totalFee to continue using this argument until removal.");
3426-
}
3427-
totalFee = options["totalFee"].get_int64();
3428-
if (totalFee <= 0) {
3429-
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid totalFee %s (must be greater than 0)", FormatMoney(totalFee)));
3430-
}
34313414
} else if (options.exists("fee_rate")) {
34323415
CFeeRate fee_rate(AmountFromValue(options["fee_rate"]));
34333416
if (fee_rate <= CFeeRate(0)) {
@@ -3460,13 +3443,8 @@ static UniValue bumpfee(const JSONRPCRequest& request)
34603443
CAmount new_fee;
34613444
CMutableTransaction mtx;
34623445
feebumper::Result res;
3463-
if (totalFee > 0) {
3464-
// Targeting total fee bump. Requires a change output of sufficient size.
3465-
res = feebumper::CreateTotalBumpTransaction(pwallet, hash, coin_control, totalFee, errors, old_fee, new_fee, mtx);
3466-
} else {
3467-
// Targeting feerate bump.
3468-
res = feebumper::CreateRateBumpTransaction(*pwallet, hash, coin_control, errors, old_fee, new_fee, mtx);
3469-
}
3446+
// Targeting feerate bump.
3447+
res = feebumper::CreateRateBumpTransaction(*pwallet, hash, coin_control, errors, old_fee, new_fee, mtx);
34703448
if (res != feebumper::Result::OK) {
34713449
switch(res) {
34723450
case feebumper::Result::INVALID_ADDRESS_OR_KEY:
@@ -4196,7 +4174,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
41964174
},
41974175
{"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
41984176
" Allows this transaction to be replaced by a transaction with higher fees"},
4199-
{"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
4177+
{"conf_target", RPCArg::Type::NUM, /* default */ "fall back to wallet's confirmation target (txconfirmtarget)", "Confirmation target (in blocks)"},
42004178
{"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
42014179
" \"UNSET\"\n"
42024180
" \"ECONOMICAL\"\n"

test/functional/wallet_bumpfee.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ def test_feerate_args(self, rbf_node, peer_node, dest_address):
130130
self.sync_mempools((rbf_node, peer_node))
131131
assert rbfid in rbf_node.getrawmempool() and rbfid in peer_node.getrawmempool()
132132

133-
assert_raises_rpc_error(-8, "confTarget can't be set with totalFee or fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.", rbf_node.bumpfee, rbfid, {"fee_rate":0.00001, "confTarget":1})
134-
assert_raises_rpc_error(-8, "confTarget can't be set with totalFee or fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.", rbf_node.bumpfee, rbfid, {"totalFee":0.00001, "confTarget":1})
135-
assert_raises_rpc_error(-8, "fee_rate can't be set along with totalFee.", rbf_node.bumpfee, rbfid, {"fee_rate":0.00001, "totalFee":0.001})
133+
assert_raises_rpc_error(-8, "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.", rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL, "confTarget": 1})
134+
135+
assert_raises_rpc_error(-3, "Unexpected key totalFee", rbf_node.bumpfee, rbfid, {"totalFee": NORMAL})
136136

137137
# Bumping to just above minrelay should fail to increase total fee enough, at least
138138
assert_raises_rpc_error(-8, "Insufficient total fee", rbf_node.bumpfee, rbfid, {"fee_rate": INSUFFICIENT})

0 commit comments

Comments
 (0)