Taking over for #16492 which seems to have gone inactive.
Only minor commit cleanups, rebase, and some help text fixes on top of previous PR. Renamed feeRate
to fee_rate
to reflect updated guidelines.
Taking over for #16492 which seems to have gone inactive.
Only minor commit cleanups, rebase, and some help text fixes on top of previous PR. Renamed feeRate
to fee_rate
to reflect updated guidelines.
94 rbfid = spend_one_input(rbf_node, dest_address)
95 rbftx = rbf_node.gettransaction(rbfid)
96 self.sync_mempools((rbf_node, peer_node))
97 assert rbfid in rbf_node.getrawmempool() and rbfid in peer_node.getrawmempool()
98- bumped_tx = rbf_node.bumpfee(rbfid)
99+ if(mode == "fee_rate"):
()
.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
@relaxo143 Unless you allow decimal points it will have less precision.
On Tue, Aug 27, 2019, 6:44 AM Relaxo143 notifications@github.com wrote:
Why does Bitcoin Core use btc/kB? Every other service/wallet seems to use sats/byte.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/16727?email_source=notifications&email_token=ABMAFUYWXNZF556SIQ4CPFTQGUAQXA5CNFSM4IPQ24D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5HJXSY#issuecomment-525245387, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMAFUZSS2H575PNQTKBVL3QGUAQXANCNFSM4IPQ24DQ .
Renamed feeRate to fee_rate to reflect updated guidelines.
Every other RPC uses “feeRate”…
Every other RPC uses “feeRate”…
We used to use confTarget, but now have conf_target
in use in various newer args. I see no reason to introduce old styles for old style sake.
going to leave #11413 type ideas alone for now.
I think this is a pretty simple feature and I’d like it in.
3352 },
3353 true, true);
3354-
3355- if (options.exists("confTarget") && options.exists("totalFee")) {
3356- throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget and totalFee options should not both be set. Please provide either a confirmation target for fee estimation or an explicit total fee for the transaction.");
3357+ // EZTODO: If FeeRate is passed in BUT its 0, give JSONRPCError.
3289@@ -3290,7 +3290,7 @@ static UniValue bumpfee(const JSONRPCRequest& request)
3290 "The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n"
3291 "By default, the new fee will be calculated automatically using estimatesmartfee.\n"
3292 "The user can specify a confirmation target for estimatesmartfee.\n"
3293- "Alternatively, the user can specify totalFee (DEPRECATED), or use RPC settxfee to set a higher fee rate.\n"
3294+ "Alternatively, the user can specify totalFee (DEPRECATED), or fee_rate (in satoshis per K) for the new transaction .\n"
3301@@ -3302,6 +3302,9 @@ static UniValue bumpfee(const JSONRPCRequest& request)
3302 " In rare cases, the actual fee paid might be slightly higher than the specified\n"
3303 " totalFee if the tx change output has to be removed because it is too close to\n"
3304 " the dust threshold."},
3305+ {"fee_rate", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "FeeRate (NOT total fee) to pay, in " + CURRENCY_UNIT + "\n"
CURRENCY_UNIT + "per kB\n"
3301@@ -3302,6 +3302,9 @@ static UniValue bumpfee(const JSONRPCRequest& request)
3302 " In rare cases, the actual fee paid might be slightly higher than the specified\n"
3303 " totalFee if the tx change output has to be removed because it is too close to\n"
3304 " the dust threshold."},
3305+ {"fee_rate", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "FeeRate (NOT total fee) to pay, in " + CURRENCY_UNIT + "\n"
3306+ " The fee_rate argument allows the users to use their own fee estimator. The resulting bump transaction will "
\n
missing
Sjors doesn’t like being addressed in third person. Also there’s no need to explain that a fee rate determines the total fee; we don’t do that in other places either. More importantly, this doesn’t cover the actual RBF rules.
What about: “Specify a specific fee rate instead of relying on the built-in fee estimator. Must be at least 0.0001 BTC per kB higher than the current rate.”
Fun fact: there’s no convenient way to find the current fee rate.
3353 true, true);
3354-
3355- if (options.exists("confTarget") && options.exists("totalFee")) {
3356- throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget and totalFee options should not both be set. Please provide either a confirmation target for fee estimation or an explicit total fee for the transaction.");
3357+ if (options.exists("confTarget") && (options.exists("totalFee") || options.exists("fee_rate"))) {
3358+ throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget can't be set with totalFee or fee_rate. Please provide either a conftarget for fee estimation, or an explicit total fee or fee rate for the transaction.");
3364@@ -3360,6 +3365,12 @@ static UniValue bumpfee(const JSONRPCRequest& request)
3365 if (totalFee <= 0) {
3366 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid totalFee %s (must be greater than 0)", FormatMoney(totalFee)));
3367 }
3368+ } else if (options.exists("fee_rate")) {
Quite a bit of code duplication in 74b271616016a5efd03d96c3077bdac79c38b134 rpc bumpfee check fee_rate argument
. Can you add a helper?
Also left some documentation nits as of d086d25.
121+
122+ // The node has a configurable incremental relay fee. Increment the fee by
123+ // the minimum of that and the wallet's conservative
124+ // WALLET_INCREMENTAL_RELAY_FEE value to future proof against changes to
125+ // network wide policy for incremental relay fee that our node may not be
126+ // aware of. This ensures we're over the over the required relay fee rate
337- new_coin_control.m_feerate = std::max(feerate, min_feerate);
338+ if (coin_control.m_feerate) {
339+ // The user provided a feeRate argument.
340+ // We calculate this here to avoid compiler warning on the cs_wallet lock
341+ const int64_t maxTxSize = CalculateMaximumSignedTxSize(*wtx.tx, wallet);
342+ Result res = CheckFeeRate(wallet, wtx, *(new_coin_control.m_feerate), maxTxSize, errors);
66+ // moment earlier. In this case, we report an error to the user, who may adjust the fee.
67+ CFeeRate minMempoolFeeRate = wallet->chain().mempoolMinFee();
68+
69+ if (newFeerate.GetFeePerK() < minMempoolFeeRate.GetFeePerK()) {
70+ errors.push_back(strprintf(
71+ "New fee rate (%s) is lower than the minimum fee rate (%s) to get into the mempool -- ",
107+ }
108+
109+ return feebumper::Result::OK;
110+}
111+
112+static CFeeRate EstimateFeeRate(CWallet* wallet, const CWalletTx& wtx, CCoinControl& coin_control, CAmount& old_fee)
const CWallet& wallet
, as this shouldn’t be mutable, nor nullable.
instagibbs
promag
DrahtBot
Sjors
Relaxo143
luke-jr
MarcoFalke
laanwj
Labels
Wallet
RPC/REST/ZMQ
Milestone
0.19.0