diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-12-04 18:13:48 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-12-04 18:14:15 +0100 |
commit | aa4b8ebfecddc7795200904009fea84b2c644141 (patch) | |
tree | 887a8343ab0575a1a63cba28d60d56c65f19f6ae /src/wallet/rpcwallet.cpp | |
parent | 68bd88597a79eea5e329e2f1ebcd54df2da29a45 (diff) | |
parent | 6313362553d91bddb75a43f62dffbec16065e4d6 (diff) | |
download | bitcoin-aa4b8ebfecddc7795200904009fea84b2c644141.tar.xz |
Merge #20510: [backport] wallet: allow zero-fee fundrawtransaction/walletcreatefundedpsbt and other fixes
6313362553d91bddb75a43f62dffbec16065e4d6 Use the correct incremental fee constant in bumpfee help (Jon Atack)
6e4969f76f58518d47ce2f2cdfc4e3ef1f2228bd Update feeRate (BTC/kvB) to fee_rate (sat/vB) in wallet_bumpfee (Jon Atack)
54e1edcc2bca76f783170768e65bf0850b036b81 Allow zero-fee fundrawtxn and walletcreatefundedpsbt calls (Jon Atack)
Pull request description:
Github-Pull: #20426
Rebased-From: 1b3d7009280595108eb22ac1188bc4367804fc5d
Github-Pull: #20426
Rebased-From: 3f1e10b2b1cd11f7112fbad6355464bd4adbbc5c
Github-Pull: #20426
Rebased-From: 9f08780dd7946b63476e9736745131db8e7f4e93
Top commit has no ACKs.
Tree-SHA512: 89556f69ca4a36d86d6ab5df740b6d5de809f13d45b03450fb526362b1eabd3d2d5285f97c552dc0bcb07e17ac2e6c557ff46335962e6bcf366d36ad412f257c
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5cbdd1021a..9ba10e6c39 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -29,7 +29,6 @@ #include <util/translation.h> #include <util/url.h> #include <util/vector.h> -#include <validation.h> #include <wallet/coincontrol.h> #include <wallet/context.h> #include <wallet/feebumper.h> @@ -217,14 +216,8 @@ static void SetFeeEstimateMode(const CWallet& wallet, CCoinControl& cc, const Un if (!estimate_mode.isNull() && estimate_mode.get_str() != "unset") { throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and fee_rate"); } - CFeeRate fee_rate_in_sat_vb{CFeeRate(AmountFromValue(fee_rate), COIN)}; - if (override_min_fee) { - if (fee_rate_in_sat_vb <= CFeeRate(0)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid fee_rate %s (must be greater than 0)", fee_rate_in_sat_vb.ToString(FeeEstimateMode::SAT_VB))); - } - cc.fOverrideFeeRate = true; - } - cc.m_feerate = fee_rate_in_sat_vb; + cc.m_feerate = CFeeRate(AmountFromValue(fee_rate), COIN); + if (override_min_fee) cc.fOverrideFeeRate = true; // Default RBF to true for explicit fee_rate, if unset. if (cc.m_signal_bip125_rbf == nullopt) cc.m_signal_bip125_rbf = true; return; @@ -3148,11 +3141,7 @@ void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& f if (options.exists("estimate_mode")) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and feeRate"); } - CFeeRate fee_rate(AmountFromValue(options["feeRate"])); - if (fee_rate <= CFeeRate(0)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid feeRate %s (must be greater than 0)", fee_rate.ToString(FeeEstimateMode::BTC_KVB))); - } - coinControl.m_feerate = fee_rate; + coinControl.m_feerate = CFeeRate(AmountFromValue(options["feeRate"])); coinControl.fOverrideFeeRate = true; } @@ -3391,7 +3380,7 @@ RPCHelpMan signrawtransactionwithwallet() static RPCHelpMan bumpfee_helper(std::string method_name) { bool want_psbt = method_name == "psbtbumpfee"; - const std::string incremental_fee{CFeeRate(DEFAULT_MIN_RELAY_TX_FEE).ToString(FeeEstimateMode::SAT_VB)}; + const std::string incremental_fee{CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE).ToString(FeeEstimateMode::SAT_VB)}; return RPCHelpMan{method_name, "\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n" @@ -3414,7 +3403,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name) {"conf_target", RPCArg::Type::NUM, /* default */ "wallet -txconfirmtarget", "Confirmation target in blocks\n"}, {"fee_rate", RPCArg::Type::AMOUNT, /* default */ "not set, fall back to wallet fee estimation", "\nSpecify a fee rate in " + CURRENCY_ATOM + "/vB instead of relying on the built-in fee estimator.\n" - "Must be at least " + incremental_fee + " " + CURRENCY_ATOM + "/vB higher than the current transaction fee rate.\n" + "Must be at least " + incremental_fee + " higher than the current transaction fee rate.\n" "WARNING: before version 0.21, fee_rate was in " + CURRENCY_UNIT + "/kvB. As of 0.21, fee_rate is in " + CURRENCY_ATOM + "/vB.\n"}, {"replaceable", RPCArg::Type::BOOL, /* default */ "true", "Whether the new transaction should still be\n" "marked bip-125 replaceable. If true, the sequence numbers in the transaction will\n" |