This lets users pick their own fees when using sendtoaddress/sendmany if they prefer this over the estimators.
[wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option #11413
pull kallewoof wants to merge 8 commits into bitcoin:master from kallewoof:explicit-fee changing 9 files +285 −91-
kallewoof commented at 6:44 AM on September 28, 2017: member
- fanquake added the label RPC/REST/ZMQ on Sep 28, 2017
- fanquake added the label Wallet on Sep 28, 2017
-
jonasschnelli commented at 2:19 PM on September 28, 2017: contributor
Not opposed to add that. Though IMO the more experience users (which are those who may use explicit fee-rates) should use create/fund/sendrawtx.
Concept ACK
-
in src/policy/fees.cpp:55 in 973f9a88ac outdated
53 | @@ -54,6 +54,7 @@ bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_esti 54 | {"UNSET", FeeEstimateMode::UNSET}, 55 | {"ECONOMICAL", FeeEstimateMode::ECONOMICAL}, 56 | {"CONSERVATIVE", FeeEstimateMode::CONSERVATIVE}, 57 | + {"EXPLICIT", FeeEstimateMode::EXPLICIT},
promag commented at 2:43 PM on September 28, 2017:The intent sounds more like no estimation so
{"NONE", FeeEstimateMode::NONE}?
kallewoof commented at 12:39 AM on September 29, 2017:I don't know. People could mistake that to mean "no fee".
in src/wallet/rpcwallet.cpp:449 in 973f9a88ac outdated
444 | @@ -445,12 +445,15 @@ UniValue sendtoaddress(const JSONRPCRequest& request) 445 | " \"UNSET\"\n" 446 | " \"ECONOMICAL\"\n" 447 | " \"CONSERVATIVE\"\n" 448 | + " \"EXPLICIT\"\n" 449 | + "9. feerate (numeric, optional) Fee rate (sat/kb) to use for EXPLICIT mode.\n"
promag commented at 2:44 PM on September 28, 2017:Mention that
estimate_modemust be set to (currenlty)EXPLICITto use this value?
kallewoof commented at 12:40 AM on September 29, 2017:to use for EXPLICIT modeis not enough?in src/wallet/rpcwallet.cpp:502 in 973f9a88ac outdated
496 | @@ -494,6 +497,12 @@ UniValue sendtoaddress(const JSONRPCRequest& request) 497 | } 498 | } 499 | 500 | + if (!request.params[8].isNull()) { 501 | + if (coin_control.m_fee_mode != FeeEstimateMode::EXPLICIT) { 502 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Explicit fee rate can only be used when estimate mode is set to EXPLICIT");
promag commented at 2:45 PM on September 28, 2017:Add test for error.
promag commented at 2:45 PM on September 28, 2017: memberPlease add tests.
esotericnonsense commented at 4:29 PM on September 28, 2017: contributorConcept ACK. I don't like that this results in sendtoaddress having 8 parameters but I don't see an immediately obvious way to avoid that.
Sendmany could get it too?
kallewoof commented at 2:22 AM on September 29, 2017: memberCan't fix people putting too high fees in, but if they put too low, they should be able to bump the fee unless they specifically disable it. As such, RBF is default-on when fees are explicit (3d14d35). @promag Added tests (1768936). @esotericnonsense I don't know how frequently this will be used. I suggest it for sendtoaddress because I see a lot of people asking how to fire off a tx with a given fee. There's also
settxfee.meshcollider commented at 12:45 PM on September 29, 2017: contributorRe: the 8 parameter issue @esotericnonsense mentioned, it would be cleaner to convert most parameters to a JSON object input like
bumpfee,listunspent, etc. use since most are independent of each other and optionalin src/rpc/client.cpp:42 in 1768936ee2 outdated
38 | @@ -39,6 +39,7 @@ static const CRPCConvertParam vRPCConvertParams[] = 39 | { "sendtoaddress", 4, "subtractfeefromamount" }, 40 | { "sendtoaddress", 5 , "replaceable" }, 41 | { "sendtoaddress", 6 , "conf_target" }, 42 | + { "sendtoaddress", 8, "feerate"},
kallewoof commented at 6:17 AM on October 1, 2017:Self-nit: space after
"feerate"kallewoof force-pushed on Oct 10, 2017kallewoof force-pushed on Oct 10, 2017kallewoof force-pushed on Oct 10, 2017kallewoof force-pushed on Oct 10, 2017luke-jr changes_requestedluke-jr commented at 12:00 PM on November 10, 2017: memberConcept ACK, but
sendmanyshould get it too.in src/wallet/rpcwallet.cpp:449 in 78bf08b658 outdated
444 | @@ -445,12 +445,15 @@ UniValue sendtoaddress(const JSONRPCRequest& request) 445 | " \"UNSET\"\n" 446 | " \"ECONOMICAL\"\n" 447 | " \"CONSERVATIVE\"\n" 448 | + " \"EXPLICIT\"\n" 449 | + "9. feerate (numeric, optional) Fee rate (sat/kb) to use for EXPLICIT mode. (Note: replaceable defaults to true when used)\n"
luke-jr commented at 1:57 PM on November 10, 2017:This isn't in the argument list above.
in src/wallet/rpcwallet.cpp:500 in 78bf08b658 outdated
496 | @@ -494,6 +497,14 @@ UniValue sendtoaddress(const JSONRPCRequest& request) 497 | } 498 | } 499 | 500 | + if (!request.params[8].isNull()) {
luke-jr commented at 1:58 PM on November 10, 2017:It doesn't make sense to add a new param for this. Instead, make
params[6]be conf target or feerate...luke-jr changes_requestedkallewoof force-pushed on Nov 13, 2017kallewoof force-pushed on Nov 13, 2017kallewoof force-pushed on Dec 8, 2017kallewoof force-pushed on Dec 8, 2017kallewoof renamed this:[wallet] [rpc] sendtoaddress: Add explicit feerate option to sendtoaddress
[wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option
on Dec 21, 2017kallewoof force-pushed on Feb 20, 2018kallewoof force-pushed on Feb 20, 2018kallewoof force-pushed on Feb 21, 2018kallewoof force-pushed on May 22, 2018kallewoof force-pushed on May 22, 2018kallewoof force-pushed on May 22, 2018kallewoof force-pushed on May 22, 2018kallewoof force-pushed on Jul 12, 2018DrahtBot added the label Needs rebase on Aug 27, 2018kallewoof force-pushed on Sep 10, 2018kallewoof force-pushed on Sep 10, 2018DrahtBot removed the label Needs rebase on Sep 10, 2018in src/wallet/rpcwallet.cpp:420 in 60a141a3c8 outdated
419 | + if (coin_control.m_fee_mode != FeeEstimateMode::EXPLICIT) { 420 | + coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]); 421 | + } else { 422 | + coin_control.m_feerate = CFeeRate(request.params[6].get_int()); 423 | + // default RBF to true for explicit fee rate mode 424 | + coin_control.m_signal_bip125_rbf = (coin_control.m_signal_bip125_rbf ? *coin_control.m_signal_bip125_rbf : false) | request.params[5].isNull();
practicalswift commented at 7:52 AM on September 21, 2018:2018-09-19 13:23:27 clang-tidy(pr=11413): src/wallet/rpcwallet.cpp:420:48: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion] 2018-09-19 13:23:27 clang-tidy(pr=11413): src/wallet/rpcwallet.cpp:420:129: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
kallewoof commented at 12:28 AM on October 6, 2018:Thanks. I assume this is referring to the
|?in src/wallet/rpcwallet.cpp:857 in 60a141a3c8 outdated
856 | + if (coin_control.m_fee_mode != FeeEstimateMode::EXPLICIT) { 857 | + coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]); 858 | + } else { 859 | + coin_control.m_feerate = CFeeRate(request.params[6].get_int()); 860 | + // default RBF to true for explicit fee rate mode 861 | + coin_control.m_signal_bip125_rbf = (coin_control.m_signal_bip125_rbf ? *coin_control.m_signal_bip125_rbf : false) | request.params[5].isNull();
practicalswift commented at 7:53 AM on September 21, 2018:2018-09-19 13:23:27 clang-tidy(pr=11413): src/wallet/rpcwallet.cpp:857:48: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion] 2018-09-19 13:23:27 clang-tidy(pr=11413): src/wallet/rpcwallet.cpp:857:129: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]DrahtBot commented at 1:31 PM on September 21, 2018: member<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #19349 (doc: Include wallet path to relevant RPC calls by D4nte)
- #18654 (rpc: separate bumpfee's psbt creation function into psbtbumpfee by achow101)
- #18531 (rpc: Assert that RPCArg names are equal to CRPCCommand ones by MarcoFalke)
- #14641 (rpc: Add min_conf option to fund transaction calls by promag)
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.
DrahtBot added the label Needs rebase on Oct 1, 2018kallewoof force-pushed on Oct 6, 2018kallewoof force-pushed on Oct 6, 2018DrahtBot removed the label Needs rebase on Oct 6, 2018sipa commented at 3:45 AM on November 11, 2018: memberConcept ACK
meshcollider commented at 7:38 AM on November 11, 2018: contributorutACK https://github.com/bitcoin/bitcoin/pull/11413/commits/d9b1c428486b8f0acb92825a01d7dc5c0994ca24, my earlier concern about adding another parameter is no longer relevant :)
in src/wallet/rpcwallet.cpp:359 in d9b1c42848 outdated
354 | @@ -355,17 +355,20 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 355 | "5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n" 356 | " The recipient will receive less bitcoins than you enter in the amount field.\n" 357 | "6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n" 358 | - "7. conf_target (numeric, optional) Confirmation target (in blocks)\n" 359 | + " Defaults to false unless explicit estimate mode is used, in which case it defaults to true\n" 360 | + "7. conf_target (numeric, optional) Confirmation target (in blocks), or fee rate (sat/kb) if explicit estimate mode is used\n"
MarcoFalke commented at 6:19 PM on November 11, 2018:Fee rates are passed in as BTC/kB (see settxfee for example) and amounts can be passed in as either num or string.
kallewoof commented at 7:45 AM on November 12, 2018:Fixed.
kallewoof force-pushed on Nov 12, 2018kallewoof force-pushed on Nov 12, 2018kallewoof force-pushed on Nov 12, 2018promag commented at 9:43 AM on November 12, 2018: memberutACK, needs squash and could add release notes.
in doc/release-notes-11413.md:1 in f6cc4a97e5 outdated
0 | @@ -0,0 +1,5 @@ 1 | +Low-level RPC changes
promag commented at 12:06 PM on November 12, 2018:nit, I may be wrong but I think you could increment
doc/release-notes-14454.md?
kallewoof commented at 12:13 PM on November 12, 2018:Hm. Does it matter? I assume the files are merged together at the end anyway.
kallewoof force-pushed on Nov 12, 2018kallewoof force-pushed on Nov 12, 2018kallewoof force-pushed on Nov 12, 2018DrahtBot added the label Needs rebase on Nov 23, 2018in src/wallet/rpcwallet.cpp:386 in 584e946bd2 outdated
356 | @@ -357,17 +357,20 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 357 | "5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n" 358 | " The recipient will receive less bitcoins than you enter in the amount field.\n" 359 | "6. replaceable (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees via BIP 125\n" 360 | - "7. conf_target (numeric, optional) Confirmation target (in blocks)\n" 361 | + " Defaults to false unless explicit estimate mode is used, in which case it defaults to true\n" 362 | + "7. conf_target (numeric, optional) Confirmation target (in blocks), or fee rate (BTC/kb) if explicit estimate mode is used\n"
luke-jr commented at 8:00 PM on November 24, 2018:Per kB, not per kb[it].
luke-jr commented at 8:02 PM on November 24, 2018:Also should use
CURRENCY_UNIThere.kallewoof force-pushed on Nov 26, 2018DrahtBot removed the label Needs rebase on Nov 26, 2018MarcoFalke deleted a comment on Nov 26, 2018DrahtBot added the label Needs rebase on Dec 5, 2018kallewoof force-pushed on Dec 10, 2018DrahtBot removed the label Needs rebase on Dec 10, 2018DrahtBot added the label Needs rebase on Dec 10, 2018kallewoof force-pushed on Dec 11, 2018DrahtBot removed the label Needs rebase on Dec 11, 2018in src/wallet/rpcwallet.cpp:381 in 271cb65a48 outdated
377 | @@ -377,6 +378,7 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 378 | + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1") 379 | + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"donation\" \"seans outpost\"") 380 | + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" true") 381 | + + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" false true 2000 EXPLICIT")
meshcollider commented at 4:39 AM on December 12, 2018:This example feerate needs updating now to be BTC/kB, 2000 BTC/kB is probably a bit high 😄
meshcollider commented at 4:47 AM on December 12, 2018: contributorkallewoof force-pushed on Dec 12, 2018DrahtBot added the label Needs rebase on Jan 29, 2019kallewoof force-pushed on Jan 30, 2019DrahtBot removed the label Needs rebase on Jan 30, 2019DrahtBot added the label Needs rebase on Feb 12, 2019kallewoof force-pushed on Feb 13, 2019DrahtBot removed the label Needs rebase on Feb 13, 2019DrahtBot added the label Needs rebase on Mar 4, 2019kallewoof force-pushed on Mar 5, 2019DrahtBot removed the label Needs rebase on Mar 5, 2019kallewoof force-pushed on Mar 5, 2019DrahtBot added the label Needs rebase on Apr 2, 2019kallewoof force-pushed on Apr 3, 2019DrahtBot removed the label Needs rebase on Apr 3, 2019in test/functional/wallet_basic.py:26 in 22a4bf730d outdated
21 | @@ -22,6 +22,8 @@ class WalletTest(BitcoinTestFramework): 22 | def set_test_params(self): 23 | self.num_nodes = 4 24 | self.setup_clean_chain = True 25 | + # node 2 needs a txindex to look up raw transactions 26 | + self.extra_args = [[], [], ["-txindex"], []]
luke-jr commented at 8:38 AM on April 4, 2019:This is part of the wrong commit. The
sendtoaddresstest only callsgetrawtransactionon a transaction in the mempool, which doesn't need a tx index.Also, the
sendmanytest that relies on this could just pass the block hash explicitly to avoid building the tx index.
luke-jr commented at 8:41 AM on April 4, 2019:Actually, you already removed the
getrawtransactionfrom sendmany, so this seems completely unnecessary?
kallewoof commented at 2:46 AM on April 5, 2019:Didn't realize that, thanks. Removed these 2 lines!
kallewoof force-pushed on Apr 5, 2019kallewoof force-pushed on Apr 5, 2019DrahtBot added the label Needs rebase on Apr 10, 2019kallewoof force-pushed on Apr 11, 2019DrahtBot removed the label Needs rebase on Apr 11, 2019in test/functional/wallet_basic.py:424 in b91af41525 outdated
363 | + conf_target=0.00002500, 364 | + estimate_mode='EXPLICIT', 365 | + ) 366 | + tx_size = self.get_vsize(self.nodes[2].gettransaction(txid)['hex']) 367 | + self.sync_all([self.nodes[0:3]]) 368 | + self.nodes[0].generate(1)
luke-jr commented at 6:27 AM on April 27, 2019:Since the block is mined by node 0, and the balance is on node 2, you need another
sync_allhere or else there's a race condition.
kallewoof force-pushed on May 7, 2019kallewoof force-pushed on May 7, 2019DrahtBot added the label Needs rebase on Jun 19, 2019kallewoof force-pushed on Jun 19, 2019DrahtBot removed the label Needs rebase on Jun 19, 2019DrahtBot added the label Needs rebase on Jun 22, 2019kallewoof force-pushed on Jun 24, 2019DrahtBot removed the label Needs rebase on Jun 24, 2019DrahtBot added the label Needs rebase on Aug 2, 2019kallewoof force-pushed on Aug 3, 2019DrahtBot removed the label Needs rebase on Aug 3, 2019kallewoof force-pushed on Aug 6, 2019kallewoof commented at 1:22 PM on August 6, 2019: memberDone. Also squashed things.
For shitcoiners, this is a drawback as a new hard-coded coin name ("btc" in "btc/kb") is introduced, but don't think anyone cares about that.
Sjors commented at 1:43 PM on August 6, 2019: memberAh, I missed this update, here was my stab at the same, plus satoshi per byte: https://github.com/Sjors/bitcoin/commit/a0996c125d59e9809306818533eba5cc6e512eb8
in src/util/fees.cpp:34 in 7d1238f91a outdated
30 | @@ -31,6 +31,7 @@ bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_esti 31 | {"UNSET", FeeEstimateMode::UNSET}, 32 | {"ECONOMICAL", FeeEstimateMode::ECONOMICAL}, 33 | {"CONSERVATIVE", FeeEstimateMode::CONSERVATIVE}, 34 | + {"btc/kb", FeeEstimateMode::BTC_KB},
MarcoFalke commented at 1:45 PM on August 6, 2019:I think we use upper case. See also
src/policy/feerate.cpp:const std::string CURRENCY_UNIT = "BTC";which you can use to express your love of shitcoins.
kallewoof commented at 1:55 PM on August 6, 2019:I am very tempted to make the parser case insensitive and use CURRENCY_UNIT as you say. Otherwise it's a bit of a pain to require users to type "BTC/kb" every time (as opposed to just "btc/kb")
MarcoFalke commented at 2:20 PM on August 6, 2019:Also, there is a difference between kilobit (kb) and kilobyte (kB)
Sjors commented at 3:06 PM on August 6, 2019:+1 for case insensitive
Also fine with CURRENCY_UNIT
I don't care about the
kBvskbdistinction as far as the parser goes, because nobody uses bits in the context of fees, but documentation wise we should do it correctly. Users will out by themselves it's case insensitive :-)
luke-jr commented at 11:25 PM on August 6, 2019:RPC is for software, not users...
kallewoof commented at 5:00 AM on August 7, 2019:It's for any entity that doesn't use the GUI, which includes non-software me.
kallewoof force-pushed on Aug 7, 2019kallewoof force-pushed on Aug 7, 2019kallewoof force-pushed on Aug 7, 2019kallewoof force-pushed on Aug 7, 2019kallewoof force-pushed on Aug 7, 2019kallewoof force-pushed on Aug 7, 2019kallewoof force-pushed on Aug 7, 2019in src/policy/fees.h:54 in 78356e5dee outdated
49 | @@ -50,6 +50,8 @@ enum class FeeEstimateMode { 50 | UNSET, //!< Use default settings based on other criteria 51 | ECONOMICAL, //!< Force estimateSmartFee to use non-conservative estimates 52 | CONSERVATIVE, //!< Force estimateSmartFee to use conservative estimates 53 | + BTC_KB, //!< Use explicit BTC/kB fee given in coin control 54 | + SAT_B, //!< Use explicit SAT/b fee given in coin control
Sjors commented at 2:32 PM on August 7, 2019:Should be upper case B.
in src/wallet/rpcwallet.cpp:379 in 78356e5dee outdated
375 | @@ -360,11 +376,13 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 376 | {"subtractfeefromamount", RPCArg::Type::BOOL, /* default */ "false", "The fee will be deducted from the amount being sent.\n" 377 | " The recipient will receive less bitcoins than you enter in the amount field."}, 378 | {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"}, 379 | - {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"}, 380 | - {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n" 381 | + {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks), or fee rate (" + CURRENCY_UNIT + "/kB) if " + (CURRENCY_UNIT + "/kB") + " estimate mode is used"},
Sjors commented at 2:34 PM on August 7, 2019:The second one should be CURRENCY_ATOM + "/B"
kallewoof commented at 2:30 AM on August 8, 2019:Hm? No it is literally saying "fee rate (BTC/kB) if BTC/kB estimate mode is used". Though since we now have two, maybe it should be "fee rate (for BTC/KB or SAT/B estimate modes)" instead.
in src/wallet/rpcwallet.cpp:840 in 78356e5dee outdated
836 | @@ -816,11 +837,13 @@ static UniValue sendmany(const JSONRPCRequest& request) 837 | }, 838 | }, 839 | {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"}, 840 | - {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"}, 841 | - {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n" 842 | + {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks), or fee rate (" + CURRENCY_UNIT + "/kB) if " + (CURRENCY_UNIT + "/kB") + " estimate mode is used"},
Sjors commented at 2:36 PM on August 7, 2019:Same issue as above
Sjors commented at 2:38 PM on August 7, 2019: memberA separate PR for the uppercase/lowercase makes sense. It looks simple enough, but it does touch networking code.
utACK 626d26c modulo documentation bug.
kallewoof force-pushed on Aug 8, 2019kallewoof force-pushed on Aug 8, 2019Sjors commented at 8:30 AM on August 8, 2019: memberutACK 601da0f981078a99b3eb5d689f42c7937199a375
in src/util/system.cpp:391 in 601da0f981 outdated
387 | @@ -388,7 +388,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin 388 | key.erase(is_index); 389 | } 390 | #ifdef WIN32 391 | - std::transform(key.begin(), key.end(), key.begin(), ToLower);
luke-jr commented at 3:24 PM on August 8, 2019:This seems to clearly perform worse. Is there a reason not to keep the current way? (A std::string ToLower overload could be in addition to this.)
kallewoof commented at 1:01 AM on August 9, 2019:I could keep the in-place transform, but seriously, this is called a couple of dozen times once at startup and not again. I think we want to aim for readability on this one.
in src/policy/fees.h:54 in 601da0f981 outdated
49 | @@ -50,6 +50,8 @@ enum class FeeEstimateMode { 50 | UNSET, //!< Use default settings based on other criteria 51 | ECONOMICAL, //!< Force estimateSmartFee to use non-conservative estimates 52 | CONSERVATIVE, //!< Force estimateSmartFee to use conservative estimates 53 | + BTC_KB, //!< Use explicit BTC/kB fee given in coin control 54 | + SAT_B, //!< Use explicit SAT/B fee given in coin control
luke-jr commented at 4:11 PM on August 8, 2019:It seems pretty ugly to pass the various units into fee estimate mode here. Can't we convert to EXPLICIT for internal stuff?
kallewoof commented at 1:02 AM on August 9, 2019:I don't understand what you are suggesting.
luke-jr commented at 2:08 AM on August 9, 2019:BTC/kB and sat/B should be limited to the RPC interface. Once it gets to CCoinControl, it should just be EXPLICIT.
kallewoof commented at 2:19 AM on August 9, 2019:Ahh, but that complicates the parser part though. Right now, it can take a string and output a
FeeEstimateMode. With your suggestion that wouldn't be sufficient.
luke-jr commented at 3:34 AM on August 9, 2019:It may actually simplify it. There's only a single call that can be inlined here.
in src/wallet/rpcwallet.cpp:437 in 601da0f981 outdated
432 | @@ -413,10 +433,6 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 433 | coin_control.m_signal_bip125_rbf = request.params[5].get_bool(); 434 | } 435 | 436 | - if (!request.params[6].isNull()) { 437 | - coin_control.m_confirm_target = ParseConfirmTarget(request.params[6], pwallet->chain().estimateMaxBlocks()); 438 | - } 439 | - 440 | if (!request.params[7].isNull()) { 441 | if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
luke-jr commented at 4:13 PM on August 8, 2019:Let's move this into
SetFeeEstimateParam...?
kallewoof commented at 1:07 AM on August 9, 2019:Done!
luke-jr changes_requestedin src/wallet/rpcwallet.cpp:387 in 601da0f981 outdated
375 | @@ -360,11 +376,13 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 376 | {"subtractfeefromamount", RPCArg::Type::BOOL, /* default */ "false", "The fee will be deducted from the amount being sent.\n" 377 | " The recipient will receive less bitcoins than you enter in the amount field."}, 378 | {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"}, 379 | - {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"}, 380 | - {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n" 381 | + {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks), or fee rate (for " + CURRENCY_UNIT + "/KB or " + CURRENCY_ATOM + "/B estimate modes)"},
luke-jr commented at 4:15 PM on August 8, 2019:"KB" is 1024 bytes; we should at least document it as "kB"
kallewoof commented at 1:08 AM on August 9, 2019:Estimate modes are all uppercase, so I don't think the convention applies here.
luke-jr commented at 2:19 AM on August 9, 2019:Since we're making them case-insensitive, it seems like a good opportunity to introduce mixed case here.
kallewoof commented at 2:27 AM on August 9, 2019:I'm not opposed to that, though it would make the PR unnecessarily bigger.
in src/policy/feerate.cpp:11 in 601da0f981 outdated
7 | @@ -8,6 +8,7 @@ 8 | #include <tinyformat.h> 9 | 10 | const std::string CURRENCY_UNIT = "BTC"; 11 | +const std::string CURRENCY_ATOM = "SAT";
luke-jr commented at 4:19 PM on August 8, 2019:Isn't "sat" usually lowercase?
kallewoof commented at 1:09 AM on August 9, 2019:Yeah, hrm. The one place it's used right now is uppercase, though, so it may make sense to just do
ToLower(CURRENCY_ATOM)in future uses. Or alternatively I useToUpper(CURRENCY_ATOM)here...
luke-jr commented at 2:10 AM on August 9, 2019:IMO
ToUpper(CURRENCY_ATOM)makes more sense, since it could just as well be "cXBT" or such in some hypothetical sidechain or future hardfork.
kallewoof commented at 2:23 AM on August 9, 2019:I am inclined to agree, but a lot of
ToUpperwas necessary: 4b304fefc517404bb109041cfcfa2a2c576c9a42
luke-jr commented at 3:35 AM on August 9, 2019:IMO only the one case in
FeeModeFromStringis actually necessary.
kallewoof commented at 4:12 AM on August 9, 2019:You mean if we mix-case the estimate modes? Yeah.
in src/wallet/rpcwallet.cpp:397 in 601da0f981 outdated
392 | @@ -375,6 +393,8 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 393 | HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1") 394 | + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"donation\" \"seans outpost\"") 395 | + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" true") 396 | + + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" false true 0.00002 " + (CURRENCY_UNIT + "/kB")) 397 | + + HelpExampleCli("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" false true 2 " + (CURRENCY_ATOM + "/b"))
luke-jr commented at 4:19 PM on August 8, 2019:Should be an uppercase B here.
kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 9, 2019kallewoof force-pushed on Aug 10, 2019kallewoof force-pushed on Aug 10, 2019in src/util/fees.cpp:31 in 3e77cbb780 outdated
27 | @@ -26,15 +28,31 @@ std::string StringForFeeReason(FeeReason reason) { 28 | return reason_string->second; 29 | } 30 | 31 | -bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) { 32 | +const std::map<std::string, FeeEstimateMode>& FeeModeMap() {
luke-jr commented at 2:13 PM on August 10, 2019:Is there any benefit to the function? (As opposed to a global map)
kallewoof commented at 2:58 PM on August 10, 2019:The windows build (AppVeyor) fails to generate the map if I don't use a function. :/
fanquake referenced this in commit b799ebcc17 on Aug 13, 2019sidhujag referenced this in commit 206e3a5511 on Aug 13, 2019kallewoof force-pushed on Aug 13, 2019kallewoof force-pushed on Aug 13, 2019kallewoof force-pushed on Aug 13, 2019in src/util/fees.cpp:49 in da9c7c1113 outdated
42 | +} 43 | + 44 | +std::string FeeModes(const std::string& delimiter = ", ") { 45 | + std::ostringstream r; 46 | + bool first = true; 47 | + for (const auto& i : FeeModeMap()) {
luke-jr commented at 3:10 PM on August 14, 2019:This ends up with the uppercased strings in docs rather than the correct "BTC/kB" and "sat/B"
kallewoof commented at 3:20 PM on August 14, 2019:Everything is uppercase right now. I'm honestly not sure if changing that is the right approach.
kallewoof commented at 6:30 AM on August 28, 2019:Code has been updated to show correct capitalization.
in src/wallet/rpcwallet.cpp:3003 in da9c7c1113 outdated
3049 | - } 3050 | - coinControl.m_confirm_target = ParseConfirmTarget(options["conf_target"], pwallet->chain().estimateMaxBlocks()); 3051 | - } 3052 | - if (options.exists("estimate_mode")) { 3053 | - if (options.exists("feeRate")) { 3054 | - throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and feeRate");
luke-jr commented at 3:10 PM on August 14, 2019:This error seems to be lost?
kallewoof commented at 3:26 PM on August 14, 2019:Good catch; re-added into the feeRate block above.
kallewoof force-pushed on Aug 14, 2019in src/wallet/rpcwallet.cpp:3333 in a887501b52 outdated
3329 | @@ -3329,10 +3330,11 @@ static UniValue bumpfee(const JSONRPCRequest& request) 3330 | }, 3331 | true, true); 3332 | 3333 | - if (options.exists("confTarget") && options.exists("totalFee")) { 3334 | + auto conf_target_exists = options.exists("confTarget") || options.exists("conf_target");
luke-jr commented at 3:32 PM on August 14, 2019:It might be better to replace this with
!conf_target.IsNull()
luke-jr commented at 3:33 PM on August 14, 2019:There's a type check above that needs to be updated for the alias. (Prefer the alias being a separate commit.)
kallewoof commented at 3:49 PM on August 14, 2019:Split alias part into separate commit and added type check.
kallewoof force-pushed on Aug 14, 2019kallewoof force-pushed on Aug 15, 2019kallewoof commented at 7:15 AM on August 15, 2019: memberSplit into 6 commits:
- CURRENCY_ATOM addition
- conf_target alias in bumpfee
- FeeMode doc helper function
- make fee estimate modes case insensitive
- add BTC/KB and SAT/B modes (all caps, like other modes)
- release notes
in src/util/fees.cpp:31 in 3279ca3e73 outdated
26 | @@ -26,15 +27,29 @@ std::string StringForFeeReason(FeeReason reason) { 27 | return reason_string->second; 28 | } 29 | 30 | -bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) { 31 | +const std::map<std::string, FeeEstimateMode>& FeeModeMap() { 32 | static const std::map<std::string, FeeEstimateMode> fee_modes = {
Sjors commented at 3:45 PM on August 15, 2019:Maybe use
<std::vector<std::pair<std::string, FeeEstimateMode>>so you can control the display order?
luke-jr commented at 12:00 PM on August 16, 2019:... but std::map is ordered, isn't it? That's why C++ added std::unordered_map?
luke-jr commented at 12:27 PM on August 16, 2019:If we really care about the order, std::map lets you specify that.
in src/wallet/rpcwallet.cpp:179 in 0d251368b7 outdated
174 | + if (cc.m_fee_mode == FeeEstimateMode::SAT_B) { 175 | + fee_rate /= 100000; // 1 sat / B = 0.00001 BTC / kB 176 | + } 177 | + cc.m_feerate = CFeeRate(fee_rate); 178 | + // default RBF to true for explicit fee rate mode 179 | + cc.m_signal_bip125_rbf = (cc.m_signal_bip125_rbf ? *cc.m_signal_bip125_rbf : false) || may_set_rbf;
Sjors commented at 4:04 PM on August 15, 2019:This seems unnecessary (or you need another test case). You can drop
may_set_rbfand useif(cc.m_signal_bip125_rbf) {*cc.m_signal_bip125_rbf = true}. See 4594923046585453beef83e833e6a422a78b66b2
kallewoof commented at 2:34 AM on August 16, 2019:Shouldn't that be
if (!cc.m_signal_bip125_rbf)? I thought optionals returned0when unset, and we only wanna set it if it's not been set already, right?
kallewoof commented at 2:39 AM on August 16, 2019:Wading through the slugfest that is boost, it seems that the most correct way to determine if an optional is uninitialized is to do
== boost::none. I.e.if (cc.m_signal_bip125_rbf == boost::none) { ... }
Sjors commented at 8:30 AM on August 16, 2019:+1 for using
boost::noneSjors commented at 4:06 PM on August 15, 2019: memberACK 81a42039e0664682ec8a35bbb9327acfce1837e2 modulo RBF code.
kallewoof force-pushed on Aug 16, 2019Sjors commented at 8:36 AM on August 16, 2019: memberACK c9971be689aab3242f35447ad20e187915f59418
Sjors commented at 9:20 AM on August 16, 2019: memberLooks better: <img width="866" alt="Schermafbeelding 2019-08-16 om 11 18 43" src="https://user-images.githubusercontent.com/10217/63157662-b5e56000-c017-11e9-9a37-3ccabecf3b09.png">
kallewoof force-pushed on Aug 16, 2019kallewoof commented at 11:44 AM on August 16, 2019: memberCool! I realized looking at your output that "unset" should be "UNSET". Fixup'd.
in src/wallet/rpcwallet.cpp:384 in c0df066dc8 outdated
384 | - {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n" 385 | - " \"UNSET\"\n" 386 | - " \"ECONOMICAL\"\n" 387 | - " \"CONSERVATIVE\""}, 388 | + {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks), or fee rate (for " + CURRENCY_UNIT + "/KB or " + ToUpper(CURRENCY_ATOM) + "/B estimate modes)"}, 389 | + {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
luke-jr commented at 1:46 PM on August 19, 2019:The
" (case insensitive)"addition is part of the wrong commit.
kallewoof commented at 6:04 AM on August 20, 2019:Moved to 'make case insensitive' commit.
promag commented at 2:53 PM on August 27, 2019:874b40cea1644812a416a517c3a4a3ab1db89144
What's the motivation to support case insensitive?
in src/util/fees.cpp:44 in c0df066dc8 outdated
43 | - auto mode = fee_modes.find(mode_string); 44 | + return fee_modes; 45 | +} 46 | 47 | - if (mode == fee_modes.end()) return false; 48 | +std::string FeeModes(const std::string& delimiter = ", ") {
luke-jr commented at 1:48 PM on August 19, 2019:Commit message calls this
FeeMode- probably should beFeeModes, so fix commit message
MarcoFalke commented at 2:37 PM on August 21, 2019:Sorry to keep nit-picking this, but you set a delimiter every time this function is called. But then you set a default value in the header, as well as in the cpp file. At the very least the default should be removed from the cpp file. I'd argue to remove it in all places.
kallewoof commented at 3:14 AM on August 22, 2019:A default
", "seemed like a sensible thing, but you're right that I don't use the default anywhere.Also, huh. I thought re-declaring the defaults in the .cpp file would result in a compiler error. Regardless, removed both.
kallewoof force-pushed on Aug 20, 2019kallewoof force-pushed on Aug 20, 2019Sjors commented at 9:03 AM on August 21, 2019: memberreACK eda3439
in src/wallet/rpcwallet.cpp:3306 in 320c13550e outdated
3322 | @@ -3323,16 +3323,20 @@ static UniValue bumpfee(const JSONRPCRequest& request) 3323 | RPCTypeCheckObj(options, 3324 | { 3325 | {"confTarget", UniValueType(UniValue::VNUM)}, 3326 | + {"conf_target", UniValueType(UniValue::VNUM)},
MarcoFalke commented at 12:01 PM on August 21, 2019:Why is this adding a new key without documentation and whose value is silently ignored if
confTargetis given? Doesn't make any sense to me and seems completely unrelated to this pull request anyway.
Sjors commented at 12:32 PM on August 21, 2019:Looks like this could be avoided entirely, though it's nice to get rid of the last remaining intsance of
confTarget. But at least there should be a throw if both are set. You could also rename the documented options toconf_target, but keepconfTargetas an undocumented alias for backwards compatibility. That should be in the release note though.
kallewoof commented at 2:00 PM on August 21, 2019:Documentation updated/release notes added. Also throws if both are given.
in doc/release-notes-11413.md:1 in 1241c094f5 outdated
0 | @@ -0,0 +1,8 @@ 1 | +Low-level RPC changes
MarcoFalke commented at 12:02 PM on August 21, 2019:Should be "updated or changed RPC", as low level changes are meant for things that are irrelevant to users
kallewoof commented at 2:02 PM on August 21, 2019:Switched to "Updated or changed RPC".
in src/wallet/rpcwallet.cpp:835 in ec8e2a5b12 outdated
816 | - " \"UNSET\"\n" 817 | - " \"ECONOMICAL\"\n" 818 | - " \"CONSERVATIVE\""}, 819 | + {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", std::string() + "The fee estimate mode, must be one of:\n" 820 | + " \"" + FeeModes("\"\n" 821 | + " \"") + "\""},
MarcoFalke commented at 12:05 PM on August 21, 2019:You don't need to pass in any whitespace here. Whitespace is done by RPCHelpMan
kallewoof commented at 2:19 PM on August 21, 2019:Point. Fixed.
in src/util/fees.cpp:35 in eda34393d5 outdated
29 | @@ -28,8 +30,8 @@ std::string StringForFeeReason(FeeReason reason) { 30 | return reason_string->second; 31 | } 32 | 33 | -const std::map<std::string, FeeEstimateMode>& FeeModeMap() { 34 | - static const std::map<std::string, FeeEstimateMode> fee_modes = { 35 | +const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap() { 36 | + static const std::vector<std::pair<std::string, FeeEstimateMode>> fee_modes = {
MarcoFalke commented at 12:06 PM on August 21, 2019:could squash this commit (eda34393d51c59ace68e08df2d6e00870fe5d797)?
kallewoof commented at 2:23 PM on August 21, 2019:Squashed.
in src/wallet/rpcwallet.cpp:188 in 8e37fc83e7 outdated
157 | @@ -158,6 +158,30 @@ static std::string LabelFromValue(const UniValue& value) 158 | return label; 159 | } 160 | 161 | +static void SetFeeEstimateMode(CWallet* const pwallet, CCoinControl& cc, const UniValue& estimate_mode, const UniValue& estimate_param)
MarcoFalke commented at 12:10 PM on August 21, 2019:style-nit: pwallet can be a reference, since it is non-nullable?
kallewoof commented at 2:26 PM on August 21, 2019:You mean
const CWallet& walletinstead? I don't see that used very often anywhere, and it seems this thing is usually astd::shared_ptr.
MarcoFalke commented at 2:39 PM on August 21, 2019:Heh, I'll just link to #15922
MarcoFalke commented at 12:11 PM on August 21, 2019: memberConcept ACK. Some questions, which you are free to ignore.
kallewoof force-pushed on Aug 21, 2019kallewoof force-pushed on Aug 21, 2019kallewoof force-pushed on Aug 21, 2019kallewoof force-pushed on Aug 22, 2019Sjors commented at 10:52 AM on August 26, 2019: memberCode review re-ACK c109001c9bb486eff3112d095a4639626273becc (and help text still looks correct)
instagibbs commented at 1:46 PM on August 27, 2019: memberconcept ACK
in src/wallet/rpcwallet.cpp:3352 in 1c0d97daa0 outdated
3329 | {"estimate_mode", UniValueType(UniValue::VSTR)}, 3330 | }, 3331 | true, true); 3332 | 3333 | - if (options.exists("confTarget") && options.exists("totalFee")) { 3334 | - 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.");
promag commented at 2:46 PM on August 27, 2019:1c0d97daa09f2fc792b8675ea535ba03c8a7b86f
There was no test for this 😞 And the new errors don't have tests either. Care to add?
kallewoof commented at 3:42 AM on August 28, 2019:Added tests for invalid parameters.
in src/util/fees.cpp:59 in 457396a409 outdated
53 | +} 54 | 55 | - fee_estimate_mode = mode->second; 56 | - return true; 57 | +bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) { 58 | + auto vector = FeeModeMap();
promag commented at 3:02 PM on August 27, 2019:457396a4091bb3c27b1e982fb7e08442120b15df
Why?
kallewoof commented at 6:30 AM on August 28, 2019:You mean why not just do
: FeeModeMap()directly? Good point.in src/util/fees.cpp:32 in 457396a409 outdated
28 | @@ -26,16 +29,32 @@ std::string StringForFeeReason(FeeReason reason) { 29 | return reason_string->second; 30 | } 31 | 32 | -bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) { 33 | - static const std::map<std::string, FeeEstimateMode> fee_modes = { 34 | +const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap() {
promag commented at 3:05 PM on August 27, 2019:457396a4091bb3c27b1e982fb7e08442120b15df
Why have this as a function? Could be a static variable in this translation unit, like
static const std::vector<std::pair<std::string, FeeEstimateMode>> FEE_MODES{ {"UNSET", FeeEstimateMode::UNSET}, {"ECONOMICAL", FeeEstimateMode::ECONOMICAL}, {"CONSERVATIVE", FeeEstimateMode::CONSERVATIVE}, {(CURRENCY_UNIT + "/KB"), FeeEstimateMode::BTC_KB}, {(ToUpper(CURRENCY_ATOM) + "/B"), FeeEstimateMode::SAT_B}, };
kallewoof commented at 3:44 AM on August 28, 2019:Windows build breaks if I do this, unfortunately.
kallewoof commented at 6:40 AM on August 28, 2019:Now that
ToUpperis no longer used, this may actually work in Windows; tentatively removing the function wrapper.in src/util/fees.cpp:42 in 457396a409 outdated
41 | + return fee_modes; 42 | +} 43 | 44 | - if (mode == fee_modes.end()) return false; 45 | +std::string FeeModes(const std::string& delimiter) { 46 | + std::ostringstream r;
promag commented at 3:07 PM on August 27, 2019:457396a4091bb3c27b1e982fb7e08442120b15df
Is it really necessary to
#include <sstream>just to concat a couple of strings? Could just dofor (i : ...) { if (!res.empty()) res += delimiter; res += i.first }
kallewoof commented at 3:47 AM on August 28, 2019:I don't really see the harm in including it (it won't make the binary bigger or anything) but it's such a trivial set of operations that I doubt it'll matter in the long run.
I.e. removing the include and just stacking onto an
std::string.in src/util/fees.cpp:43 in 457396a409 outdated
40 | - auto mode = fee_modes.find(mode_string); 41 | + return fee_modes; 42 | +} 43 | 44 | - if (mode == fee_modes.end()) return false; 45 | +std::string FeeModes(const std::string& delimiter) {
promag commented at 3:09 PM on August 27, 2019:457396a4091bb3c27b1e982fb7e08442120b15df
This is a utility function for the RPC help, I'd move to
rpcwallet.cppand make it static there.BTW, according to dev notes
Braces on new lines for classes, functions, methods.
kallewoof commented at 4:04 AM on August 28, 2019:Fixed style.
kallewoof commented at 6:43 AM on August 28, 2019:Forgot to respond to the first point; I could move
FeeModes, but it would mean having to makefee_modesavailable to the public, which doesn't seem worth it.in src/util/fees.cpp:61 in c109001c9b outdated
59 | - return true; 60 | +bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) { 61 | + auto searchkey = ToUpper(mode_string); 62 | + auto vector = FeeModeMap(); 63 | + for (const auto& pair : vector) { 64 | + if (pair.first == searchkey) {
promag commented at 3:35 PM on August 27, 2019:Regarding https://github.com/bitcoin/bitcoin/pull/11413/files#r313929142
Then I'd do
ToUpper(pair.first) == searchkey)and display the right casing.
kallewoof commented at 6:26 AM on August 28, 2019:Done.
kallewoof force-pushed on Aug 28, 2019kallewoof force-pushed on Aug 28, 2019kallewoof force-pushed on Aug 28, 2019kallewoof force-pushed on Aug 28, 2019kallewoof force-pushed on Aug 28, 2019Sjors commented at 8:02 AM on August 28, 2019: memberMysterious Windows failure: <img width="825" alt="Schermafbeelding 2019-08-28 om 10 02 31" src="https://user-images.githubusercontent.com/10217/63837028-faa7ba00-c97a-11e9-8f79-369da0ebd10f.png">
kallewoof force-pushed on Aug 28, 2019in src/util/fees.cpp:33 in aed101cf1c outdated
37 | - {"CONSERVATIVE", FeeEstimateMode::CONSERVATIVE}, 38 | - }; 39 | - auto mode = fee_modes.find(mode_string); 40 | - 41 | - if (mode == fee_modes.end()) return false; 42 | +static const std::vector<std::pair<std::string, FeeEstimateMode>> fee_modes = {
promag commented at 9:54 AM on August 28, 2019:Should be
FEE_MODES.in test/functional/wallet_bumpfee.py:99 in aed101cf1c outdated
87 | @@ -87,6 +88,38 @@ def run_test(self): 88 | test_no_more_inputs_fails(rbf_node, dest_address) 89 | self.log.info("Success") 90 | 91 | +def test_invalid_parameters(node, dest_address): 92 | + txid = spend_one_input(node, dest_address) 93 | + # invalid estimate mode 94 | + assert_raises_rpc_error(-8, "Invalid estimate_mode parameter", node.bumpfee, txid, {
promag commented at 11:55 AM on August 28, 2019:nit, space after
:here and below.in doc/release-notes-11413.md:5 in aed101cf1c outdated
0 | @@ -0,0 +1,10 @@ 1 | +Updated or changed RPC 2 | +---------------------- 3 | + 4 | +The `bumpfee`, `fundrawtransaction`, `sendmany`, `sendtoaddress`, and `walletcreatefundedpsbt` 5 | +RPC commands have been updated to include two new fee estimation methods "BTC/KB" and "SAT/B".
promag commented at 11:55 AM on August 28, 2019:fix case.
in doc/release-notes-11413.md:11 in aed101cf1c outdated
5 | +RPC commands have been updated to include two new fee estimation methods "BTC/KB" and "SAT/B". 6 | +The target is the fee expressed explicitly in the given form. 7 | + 8 | +In addition, the estimate_mode parameter is now case insensitive for all of the above RPC commands. 9 | + 10 | +The `bumpfee` command now uses `conf_target` rather than `confTarget` in the options.
promag commented at 11:56 AM on August 28, 2019:Should mention that
confTargetis still supported but clients should transition toconf_target.
kallewoof commented at 1:06 PM on August 28, 2019:I don't really see the point. Literally nobody will be affected by this (i.e. they will either see the release notes and switch, or not see them and not notice the change).
in src/util/fees.cpp:45 in aed101cf1c outdated
49 | + 50 | +std::string FeeModes(const std::string& delimiter) 51 | +{ 52 | + std::string r; 53 | + std::string prefix = ""; 54 | + for (const auto& i : fee_modes) {
promag commented at 11:58 AM on August 28, 2019:s/i/pair like below?
kallewoof force-pushed on Aug 28, 2019kallewoof commented at 2:50 PM on August 28, 2019: memberYikes... turning back into a function. @promag
<img width="1003" alt="Screen Shot 2019-08-28 at 23 49 33" src="https://user-images.githubusercontent.com/250224/63866672-89095380-c9ee-11e9-9b0d-a5850ba48d6b.png">
Actually gonna see if adding const strings for the two fee rates fixes it.
Edit: const strings did not help.
kallewoof force-pushed on Aug 28, 2019kallewoof force-pushed on Aug 28, 2019kallewoof force-pushed on Aug 28, 2019promag commented at 6:44 PM on August 28, 2019: member@kallewoof well..
kallewoof force-pushed on Aug 29, 2019kallewoof force-pushed on Aug 29, 2019kallewoof force-pushed on Aug 29, 2019kallewoof commented at 6:40 AM on August 29, 2019: memberI found a different workaround; apparently MSVC does not bug out if you put the
const std::strings in the.hfile. We do that elsewhere so I assume nobody will complain about movingCURRENCY_UNITintofeerate.hfromfeerate.cpp.kallewoof force-pushed on Aug 29, 2019kallewoof force-pushed on Aug 29, 2019promag commented at 10:25 AM on August 29, 2019: memberShouldn't
conf_targetbe required when using an explicit estimate mode?kallewoof force-pushed on Aug 29, 2019in src/wallet/rpcwallet.cpp:182 in a69cb01737 outdated
177 | + fee_rate /= 100000; // 1 sat / B = 0.00001 BTC / kB 178 | + } 179 | + cc.m_feerate = CFeeRate(fee_rate); 180 | + // default RBF to true for explicit fee rate modes 181 | + if (cc.m_signal_bip125_rbf == boost::none) cc.m_signal_bip125_rbf = true; 182 | + } else {
promag commented at 11:55 AM on August 29, 2019:else if (! estimate_param.isNull()) {?
kallewoof commented at 2:21 PM on August 29, 2019:Done
kallewoof force-pushed on Aug 29, 2019instagibbs commented at 6:42 PM on August 30, 2019: memberconcept ACK, but I am really wary of the implementation of the arguments.
The meaning of
conf_targetbasically inverts with this new argument. Consider:sendtoaddress 2N7GTLzhS9n3FzwAQohAgnk2kGvt8eE9nng 1 "" "" false true 1008and
sendtoaddress 2N7GTLzhS9n3FzwAQohAgnk2kGvt8eE9nng 1 "" "" false true 1008 sat/Band the opposite way:
1vs1 sat/Bis likely considerable.I'd rather we "overload" the
conf_targetand parse30sat/Bdirectly, disallowing estimate mode to be specified maybe other thanunset.in test/functional/wallet_basic.py:469 in 3a29129e86 outdated
416 | + self.nodes[0].generate(1) 417 | + self.sync_all(self.nodes[0:3]) 418 | + postbalance = self.nodes[2].getbalance() 419 | + fee = prebalance - postbalance - Decimal('1') 420 | + assert_fee_amount(fee, tx_size, Decimal('0.00002000')) 421 | +
instagibbs commented at 6:45 PM on August 30, 2019:Add a test for negative/too low feerates?
kallewoof commented at 4:35 AM on September 2, 2019:Done
Sjors commented at 6:47 PM on August 30, 2019: memberI'd rather we "overload" the conf_target and parse 30sat/B directly, disallowing estimate mode to be specified maybe other than unset.
If that's easy to implement I also think it's significantly more clear.
instagibbs commented at 6:57 PM on August 30, 2019: memberThe issue still remains for someone who types
1and forgets to writesat/B. I'm not sure if there's a backwards compatible way to solve this.luke-jr commented at 8:26 PM on August 30, 2019: memberSpecifying an amount as a string like that is completely foreign to all existing RPC interfaces.
The number is already interpreted differently based on the mode string.
kallewoof force-pushed on Sep 2, 2019kallewoof commented at 4:48 AM on September 2, 2019: member@instagibbs Yeah, typing '1' would mean 'confirm within 1 block' which is directly opposite of '1 sat/b'.
Adding number suffixes only partially solves the problem. Someone who accidentally hits enter forgetting the 'sat/b' suffix will have exactly the same issue.
Perhaps the explicit modes should not overload
conf_targetbut instead use a new argument entirely. Alternatively we make the estimate_mode include the actual number, so people will do[...]conf_target=null estimate_mode=1sat/b [...]which means the ambiguity is removed. If they do
estimate_mode=1it will error. Andconf_targetno longer both means "low value = high priority = potentially high fees" and "low value = low fees" at the same time, depending on which estimate mode is used at the time.kallewoof force-pushed on Sep 2, 2019kallewoof commented at 5:32 AM on September 2, 2019: memberAnother alternative is to actually require suffixes for all conf_targets, but that is a compatibility breach (1 block, 1 sat/b, 1 btc/kb).
Sjors commented at 11:26 AM on September 2, 2019: memberI don't like including the string in the same param (without a space). Nor do I like the verboseness of named params.
Making a breaking change might be worth it for the extra safety. It would fail quite gracefully, i.e. it just stops sending. The impact can be reduced by not requiring
estimate_modewhen using named parameters.luke-jr referenced this in commit 5f1be949ae on Sep 3, 2019DrahtBot added the label Needs rebase on Oct 2, 2019laanwj added the label Feature on Oct 2, 2019kallewoof force-pushed on Oct 3, 2019DrahtBot removed the label Needs rebase on Oct 3, 2019in src/wallet/rpcwallet.cpp:198 in 97636cd371 outdated
193 | + if (cc.m_fee_mode == FeeEstimateMode::SAT_B) { 194 | + fee_rate /= 100000; // 1 sat / B = 0.00001 BTC / kB 195 | + } 196 | + cc.m_feerate = CFeeRate(fee_rate); 197 | + // if feerate < 0.1 sat/b, throw 198 | + if (fee_rate < 100) {
luke-jr commented at 4:45 PM on October 17, 2019:This shouldn't be hard-coded
kallewoof commented at 7:07 AM on October 18, 2019:Turned into constant. Also did same for the conversion a few lines above.
kallewoof force-pushed on Oct 18, 2019kallewoof force-pushed on Oct 18, 2019in src/wallet/rpcwallet.cpp:44 in 8a7882a91f outdated
38 | @@ -39,6 +39,10 @@ 39 | 40 | static const std::string WALLET_ENDPOINT_BASE = "/wallet/"; 41 | 42 | +static const uint32_t WALLET_MIN_FEERATE = 100; // sat/b 43 | + 44 | +static const uint32_t WALLET_BTC_KB_TO_SAT_B = 100000; // 1 sat / B = 0.00001 BTC / kB
luke-jr commented at 4:45 PM on October 21, 2019:Please use the
COINconst for this...
kallewoof commented at 3:25 AM on October 24, 2019:Changed to
COIN / 1000.in src/wallet/rpcwallet.cpp:42 in 8a7882a91f outdated
38 | @@ -39,6 +39,10 @@ 39 | 40 | static const std::string WALLET_ENDPOINT_BASE = "/wallet/"; 41 | 42 | +static const uint32_t WALLET_MIN_FEERATE = 100; // sat/b
luke-jr commented at 4:46 PM on October 21, 2019:This is wrong. Relay min feerate is already defined elsewhere, and user-configurable.
kallewoof commented at 3:30 AM on October 24, 2019:Using
DEFAULT_MIN_RELAY_TX_FEEinstead.
kallewoof commented at 3:32 AM on October 24, 2019:Actually, I would have to include
validation.hto access that, and I can't access it viaexternbecause it'sstatic. I'm just doing1000 /* DEFAULT_MIN_RELAY_TX_FEE */for now.
luke-jr commented at 3:43 AM on October 24, 2019:Using the default would be wrong too. It should use the configured policy or current mempool limit...
kallewoof commented at 3:57 AM on October 24, 2019:I don't see a problem with someone making a tx that is not relayable at this point in time (but relayable when tx traffic drops). In fact, I'm not even sure this check is necessary in the first place.
luke-jr commented at 12:09 PM on October 24, 2019:In that case, it should be the configured relay minimum policy (or no check at all).
kallewoof commented at 2:30 AM on October 25, 2019:I'm honestly leaning towards removing this check. Thanks for the nudge.
kallewoof force-pushed on Oct 24, 2019kallewoof force-pushed on Oct 25, 2019kallewoof force-pushed on Oct 29, 2019kallewoof force-pushed on Nov 1, 2019Sjors commented at 4:41 PM on November 1, 2019: memberTested ACK 398be1c modulo squash.
Positional arguments are nigh-impossible to use, but let's worry about that later...
bitcoin-cli sendtoaddress bc... 1 "" "" false true 1 sat/b bitcoin-cli sendmany "" '{"bc...": 1}' 0 "" '[]' true 1 sat/bA mix of positional and named kind of works:
sendtoaddress bcrt1qgr3zfmvqzl4uv3utz6h849x0fu5a8mvg695jde 1 -conf_target=1 estimate_mode=sat/bluke-jr referenced this in commit 3cea15ad1d on Nov 15, 2019luke-jr referenced this in commit 9cd046568a on Nov 15, 2019luke-jr referenced this in commit c2f29682ee on Nov 15, 2019luke-jr referenced this in commit 399dc09052 on Jan 12, 2020luke-jr referenced this in commit 6c40dcb3dd on Jan 12, 2020luke-jr referenced this in commit 4c6e72a068 on Jan 12, 2020in test/functional/wallet_basic.py:398 in 398be1c0f3 outdated
390 | @@ -338,6 +391,74 @@ def run_test(self): 391 | # This will raise an exception for importing an invalid pubkey 392 | assert_raises_rpc_error(-5, "Pubkey is not a valid public key", self.nodes[0].importpubkey, "5361746f736869204e616b616d6f746f") 393 | 394 | + # send with explicit btc/kb fee 395 | + self.sync_all(self.nodes[0:3]) 396 | + self.log.info("test explicit fee (sendtoaddress as btc/kb)") 397 | + self.nodes[0].generate(1)
luke-jr commented at 4:33 AM on January 16, 2020:The
sync_allneeds to be moved aftergenerate, orprebalancecould end up with a stale balance and cause the check below (line 426) to fail.
kallewoof commented at 4:44 AM on January 16, 2020:Moved.
kallewoof force-pushed on Jan 16, 2020kallewoof force-pushed on Jan 16, 2020Sjors commented at 12:43 PM on January 16, 2020: memberCode review re-ACK 9721534f1c929ce275ac0516d5777bc1063f7495
luke-jr referenced this in commit 296f665983 on Jan 16, 2020luke-jr referenced this in commit ee7255ddc8 on Jan 16, 2020Sjors commented at 3:44 PM on February 20, 2020: memberStill works when rebased. @achow101 @instagibbs maybe you can (re-)review?
in src/wallet/rpcwallet.cpp:3255 in c7d20ff95a outdated
3340 | @@ -3341,7 +3341,7 @@ static UniValue bumpfee(const JSONRPCRequest& request) 3341 | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid to be bumped"}, 3342 | {"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "", 3343 | { 3344 | - {"confTarget", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"}, 3345 | + {"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
instagibbs commented at 3:20 PM on February 26, 2020:convert tests for coverage?
kallewoof commented at 4:43 AM on March 2, 2020:I thought I did -- which one did I miss?
instagibbs commented at 2:52 PM on March 2, 2020:For that commit I didn't see any changes... I'll look again
in src/wallet/rpcwallet.cpp:198 in bca8d502f5 outdated
193 | + } 194 | + } 195 | + 196 | + if (cc.m_fee_mode == FeeEstimateMode::BTC_KB || cc.m_fee_mode == FeeEstimateMode::SAT_B) { 197 | + if (estimate_param.isNull()) { 198 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Selected estimate_mode requires a confirmation target");
instagibbs commented at 3:30 PM on February 26, 2020:s/confirmation target/fee rate/?
kallewoof commented at 4:45 AM on March 2, 2020:Right! Thanks.
in src/wallet/rpcwallet.cpp:188 in bca8d502f5 outdated
184 | @@ -183,6 +185,33 @@ static std::string LabelFromValue(const UniValue& value) 185 | return label; 186 | } 187 | 188 | +static void SetFeeEstimateMode(CWallet* const pwallet, CCoinControl& cc, const UniValue& estimate_mode, const UniValue& estimate_param)
instagibbs commented at 3:30 PM on February 26, 2020:A bit of documentation would go a long way for function declaration.
kallewoof commented at 8:36 AM on March 2, 2020:Added documentation!
in doc/release-notes-11413.md:4 in 986075dcdd outdated
0 | @@ -0,0 +1,10 @@ 1 | +Updated or changed RPC 2 | +---------------------- 3 | + 4 | +The `bumpfee`, `fundrawtransaction`, `sendmany`, `sendtoaddress`, and `walletcreatefundedpsbt`
instagibbs commented at 3:39 PM on February 26, 2020:Note that this will also trigger bip125 opt-in.
kallewoof commented at 8:35 AM on March 2, 2020:Added note.
instagibbs commented at 3:41 PM on February 26, 2020: memberlooks good, couple of notes
kallewoof force-pushed on Mar 2, 2020kallewoof force-pushed on Mar 2, 2020kallewoof commented at 8:37 AM on March 2, 2020: member@instagibbs Thanks for the review! Addressed everything except the coverage part which I am hoping you'll clarify.
Sjors commented at 8:39 AM on March 2, 2020: member~Code review re-ACK 74f9d2797bd199fcd4cfc30e490bbac6224424f9~
Actually there's a problem the user tries to set the fee rate to
0.1 sat/b. It silently rounds up to1. This should throw an error or work (setting the fee slightly below the min relay fee, e.g. 1.2 sat/b can be useful).To reproduce, add this to
wallet_basic_pytxid = self.nodes[2].sendtoaddress( address=address, amount=1.0, conf_target=0.2, estimate_mode='SAT/B', ) tx_size = self.get_vsize(self.nodes[2].gettransaction(txid)['hex']) self.sync_all(self.nodes[0:3]) self.nodes[0].generate(1) self.sync_all(self.nodes[0:3]) postbalance = self.nodes[2].getbalance() fee = prebalance - postbalance - Decimal('1') assert_fee_amount(fee, tx_size, Decimal('0.00000200'))Result:
File "test/functional/wallet_basic.py", line 476, in run_test assert_fee_amount(fee, tx_size, Decimal('0.00000200')) File "/Users/sjors/dev/bitcoin/test/functional/test_framework/util.py", line 42, in assert_fee_amount raise AssertionError("Fee of %s BTC too high! (Should be %s BTC)" % (str(fee), str(target_fee))) AssertionError: Fee of 1.00000423 BTC too high! (Should be 2.8E-7 BTC)kallewoof commented at 5:10 AM on March 3, 2020: memberUpdated code to now return an error when creating a transaction if the requested explicit fee rate differs from the required fee rate. This prevents silently ignoring the user when they want a fee rate < ~1 sat/b~ the current minimum fee rate (which may change due to mempool state, and/or future changes to the current 1 sat/b minimum policy default) -- it now gives an error, as you would expect.
Edit: changed from "1 sat/b" to a more accurate description.
in src/wallet/wallet.cpp:2666 in 77d73422b0 outdated
2659 | @@ -2660,6 +2660,12 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std 2660 | 2661 | // Get the fee rate to use effective values in coin selection 2662 | CFeeRate nFeeRateNeeded = GetMinimumFeeRate(*this, coin_control, &feeCalc); 2663 | + // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly 2664 | + // provided one 2665 | + if (coin_control.m_feerate && nFeeRateNeeded != *coin_control.m_feerate) { 2666 | + strFailReason = "Fee rate needed differs from explicitly provided fee rate";
Sjors commented at 5:24 PM on March 3, 2020:"needed" is rather vague. I assume this is based on the mempool relay fee? So maybe:
Fee rate is too low for the current mempool. Increase it to %f sat/b or modify -maxmempool
kallewoof commented at 2:11 AM on March 4, 2020:That's a bit weird, though, for the case when the relay fee is at the minimum. We can't really ask people to change
minrelaytxfeeeither, as that would mean their node ends up with non-relayable (to most other nodes) transactions. I don't really see a better alternative though, so I'm going with your version with some tweaks:I built on this a tiny bit, adding a new optional
FeeEstimateModeparameter toCFeeRate::ToString(), which returns sat/b formatted fee rate if estimate mode is sat/b, otherwise the (pre-existing) btc/kb fee rate. So if a user provides an explicit fee rate usingsat/b, they get the needed one back in sat/b, otherwise it is expressed in btc/kb.
Sjors commented at 9:19 AM on March 4, 2020:There have been occasional rumblings of allowing a lower relay fee than 1 sat/byte, so it's nice to future proof. It's not an ideal message, but definitely better than silently changing the input.
kallewoof commented at 9:23 AM on March 4, 2020:This should cover for the <1sat/b case as well. All the way down to 0.001 sat/b.
kallewoof commented at 9:52 AM on March 4, 2020:I updated #11413 (comment) a bit to clarify that 1 sat/b is not a hardcoded thing.
Sjors commented at 10:10 AM on March 4, 2020:IIUC coin selection uses
nFeeRateNeededhere:coin_selection_params.effective_fee = nFeeRateNeeded;This doesn't make sense for transaction with a future nLockTime, and with PSBTs it's debatable, since we don't know when the user intends to broadcast. For
sendmanyandsendtoaddressthe current behavior is fine, because those RPCs don't support nLockTime and PSBT.For PSBT I'm inclined to think that
effective_feeshould be set to the manual fee. In #16378 I plan to do the same for the newsendRPC. It returns the hex in that case (as it does withnLockTime).
kallewoof commented at 10:19 AM on March 4, 2020:So basically, you'd prefer if I could force a transaction using a fee rate that is currently not actually accepted by the mempool? I initially did that, but the result is that the tx goes into the mempool but is rejected by the node's peers, so it is never mined (unless the node itself generates a block). That seems awfully confusing.
Perhaps there should be an exception for the locktime>now case, where a warning is produced but the tx is created since it can't go into the mempool anyway, due to locktime not unfulfilled.
This can be achieved by setting the
fOverrideFeeRatetotrue, btw.
Sjors commented at 10:22 AM on March 4, 2020:I think the current error is fine when the user intends to broadcast immediately. Only when that's not clearly the case, e.g. for the PSBT methods, we should still allow transaction creation.
Sjors commented at 10:24 AM on March 4, 2020:fOverrideFeeRatecould do the trick, but it's pretty ugly: it basically "sabotages"GetMinimumFeeRate. It seems more readable to skipGetMinimumFeeRatealtogether when you want to ignore it.kallewoof force-pushed on Mar 4, 2020kallewoof force-pushed on Mar 4, 2020kallewoof force-pushed on Mar 4, 2020in src/policy/feerate.cpp:41 in 5febd8a183 outdated
34 | @@ -37,7 +35,10 @@ CAmount CFeeRate::GetFee(size_t nBytes_) const 35 | return nFee; 36 | } 37 | 38 | -std::string CFeeRate::ToString() const 39 | +std::string CFeeRate::ToString(const FeeEstimateMode& fee_estimate_mode) const 40 | { 41 | - return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT); 42 | + switch (fee_estimate_mode) { 43 | + case FeeEstimateMode::SAT_B: return strprintf("%d.%03d %s/b", nSatoshisPerK / 1000, nSatoshisPerK % 1000, CURRENCY_ATOM);
luke-jr commented at 11:22 PM on March 4, 2020:Satoshis per bit?
kallewoof commented at 1:35 AM on March 5, 2020:Good catch, fixed!
kallewoof force-pushed on Mar 5, 2020kallewoof force-pushed on Mar 5, 2020in src/wallet/wallet.cpp:2724 in 7c4efefab2 outdated
2582 | @@ -2583,6 +2583,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std 2583 | int& nChangePosInOut, std::string& strFailReason, const CCoinControl& coin_control, bool sign) 2584 | { 2585 | CAmount nValue = 0; 2586 | + nFeeRet = 0;
instagibbs commented at 2:19 PM on March 5, 2020:is this valuable by itself?
kallewoof commented at 3:17 AM on March 6, 2020:Probably. I had a garbage value being returned and it ended up telling me "you need at least 4587368374.13587638 bitcoin in fees!" here:
in src/wallet/wallet.cpp:2744 in 2f13183751 outdated
2659 | @@ -2660,6 +2660,12 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std 2660 | 2661 | // Get the fee rate to use effective values in coin selection 2662 | CFeeRate nFeeRateNeeded = GetMinimumFeeRate(*this, coin_control, &feeCalc); 2663 | + // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
instagibbs commented at 2:19 PM on March 5, 2020:same question: this seems good irrespective of this PR
kallewoof commented at 3:18 AM on March 6, 2020:Yeah, it could be its own PR. Maybe I should split these out..
instagibbs approvedinstagibbs commented at 3:23 PM on March 5, 2020: memberutACK https://github.com/bitcoin/bitcoin/pull/11413/commits/021c253961d6c51dbc1d031449b1b3d0f5edef8b
I'll hopefully get around to testing a bit.
luke-jr referenced this in commit 781e816cf1 on Mar 5, 2020luke-jr referenced this in commit 4e9be35e87 on Mar 5, 2020luke-jr referenced this in commit 5725c9c605 on Mar 5, 2020luke-jr referenced this in commit 940408c72a on Mar 5, 2020instagibbs commented at 4:40 PM on March 5, 2020: membersomething to think about out loud for the future: If we want to support implicit CPFP, this new mode would probably turn that off, at least by default.
in src/wallet/wallet.cpp:2803 in 2f13183751 outdated
2659 | @@ -2660,6 +2660,12 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std 2660 | 2661 | // Get the fee rate to use effective values in coin selection 2662 | CFeeRate nFeeRateNeeded = GetMinimumFeeRate(*this, coin_control, &feeCalc); 2663 | + // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly 2664 | + // provided one 2665 | + if (coin_control.m_feerate && nFeeRateNeeded > *coin_control.m_feerate) { 2666 | + strFailReason = strprintf("Fee rate is too low for the current mempool. Increase it to %s or modify -maxmempool", nFeeRateNeeded.ToString(coin_control.m_fee_mode));
instagibbs commented at 4:44 PM on March 5, 2020:Actually I find this
-maxmempooladvice pretty dangerous for users. It's going to simply result in stuck transactions, no?
kallewoof commented at 3:22 AM on March 6, 2020:I think it might get stuck for the user themselves, but unless their peers also increase their mempool sizes, it won't propagate very far. But I'm now a bit hesitant to suggest using it as it'll probably not do what people expect. (As you say, it will get stuck in the sense that it won't get mined or propagate properly..)
sipa commented at 3:01 AM on March 13, 2020:Agree that we shouldn't mention -maxmempool here; it indeed likely will not do what users expect it to do.
kallewoof commented at 4:19 AM on March 13, 2020:Changed to "Fee rate is too low for the current mempool. Increase it to %s or wait."
kallewoof force-pushed on Mar 6, 2020DrahtBot added the label Needs rebase on Mar 7, 2020kallewoof force-pushed on Mar 7, 2020DrahtBot removed the label Needs rebase on Mar 7, 2020DrahtBot added the label Needs rebase on Mar 11, 2020kallewoof force-pushed on Mar 12, 2020DrahtBot removed the label Needs rebase on Mar 12, 2020kallewoof force-pushed on Mar 12, 2020kallewoof commented at 12:45 PM on March 12, 2020: memberGood catch; dropped 7864c1f.
Sjors commented at 1:41 PM on March 12, 2020: memberutACK 04e94beb1d9f22809b64bda2c7e92c1e911d2227
instagibbs commented at 1:52 PM on March 12, 2020: memberfanquake requested review from meshcollider on Mar 13, 2020in doc/release-notes-11413.md:7 in 04e94beb1d outdated
0 | @@ -0,0 +1,11 @@ 1 | +Updated or changed RPC 2 | +---------------------- 3 | + 4 | +The `bumpfee`, `fundrawtransaction`, `sendmany`, `sendtoaddress`, and `walletcreatefundedpsbt` 5 | +RPC commands have been updated to include two new fee estimation methods "BTC/kB" and "sat/B". 6 | +The target is the fee expressed explicitly in the given form. Note that use of this feature 7 | +will trigger bip125 (replace-by-fee) opt-in.
sipa commented at 2:58 AM on March 13, 2020:Nit: BIP is usually capitalized.
sipa commented at 3:03 AM on March 13, 2020: memberutACK 04e94beb1d9f22809b64bda2c7e92c1e911d2227, apart from the -maxmempool nit below.
kallewoof force-pushed on Mar 13, 2020fanquake requested review from Sjors on Mar 13, 2020fanquake requested review from sipa on Mar 13, 2020fanquake requested review from instagibbs on Mar 13, 2020kallewoof force-pushed on Mar 13, 2020Sjors approvedSjors commented at 4:58 PM on March 13, 2020: memberre-utACK 6fef8dcd771f1a628d2c4bee2682a98312bcd80b: recommending patience can't hurt :-)
instagibbs commented at 5:01 PM on March 13, 2020: memberDrahtBot added the label Needs rebase on Mar 26, 2020kallewoof force-pushed on Mar 30, 2020kallewoof commented at 7:55 AM on March 30, 2020: memberRebased
DrahtBot removed the label Needs rebase on Mar 30, 2020Sjors commented at 9:23 AM on March 30, 2020: memberre-utACK a29b9939b6537e60a9dd47e0ae49968851cac251
DrahtBot added the label Needs rebase on Apr 27, 2020kallewoof force-pushed on Apr 28, 2020kallewoof force-pushed on Apr 28, 2020DrahtBot removed the label Needs rebase on Apr 28, 2020Sjors commented at 6:36 PM on April 28, 2020: memberre-utACK 9afd897, just a rebase and some tests have moved.
in test/functional/wallet_basic.py:486 in 9afd897104 outdated
481 | + # 1. Send some coins to generate new UTXO 482 | + address_to_import = self.nodes[2].getnewaddress() 483 | + txid = self.nodes[0].sendtoaddress(address_to_import, 1) 484 | + self.nodes[0].generate(1) 485 | + self.sync_all(self.nodes[0:3]) 486 | +
luke-jr commented at 2:19 AM on May 9, 2020:I believe this was a mis-rebase. This test goes back to 2016, and is above the added tests (prior to the rebase, it was here, below the added tests)
kallewoof commented at 4:47 AM on May 9, 2020:Yes, that is correct! Good catch. Fixed.
kallewoof force-pushed on May 9, 2020kallewoof force-pushed on May 9, 2020kallewoof commented at 5:03 AM on May 9, 2020: memberDropped 'fee rate changed' commit, as it is its own PR now (#18275).
kallewoof force-pushed on May 10, 2020luke-jr referenced this in commit 27c462a3fa on Jun 9, 2020luke-jr referenced this in commit f68ea7c542 on Jun 9, 2020luke-jr referenced this in commit 2612e4808d on Jun 9, 2020luke-jr referenced this in commit dace8ef7b7 on Jun 9, 2020luke-jr referenced this in commit e08e516d89 on Jun 9, 2020luke-jr referenced this in commit 56bd8c3404 on Jun 9, 2020in src/util/fees.cpp:41 in 53342290f4 outdated
43 | +static const std::vector<std::pair<std::string, FeeEstimateMode>> FEE_MODES = { 44 | + {"unset", FeeEstimateMode::UNSET}, 45 | + {"economical", FeeEstimateMode::ECONOMICAL}, 46 | + {"conservative", FeeEstimateMode::CONSERVATIVE}, 47 | + {(CURRENCY_UNIT + "/kB"), FeeEstimateMode::BTC_KB}, 48 | + {(CURRENCY_ATOM + "/B"), FeeEstimateMode::SAT_B},
luke-jr commented at 7:15 AM on June 14, 2020:We can't use
CURRENCY_*here in global scope, since the initialisation order is undefined. A simple static function wrapper should work.
kallewoof commented at 6:01 AM on June 16, 2020:Odd that no compiler warning or anything was emitted about it. I've updated the code to wrap the map.
Sjors commented at 9:58 AM on June 16, 2020:For future reference, the original: 3bad9a438769c6749063ab5ab405a62f6efea8cc
jonatack commented at 4:07 PM on June 15, 2020: memberConcept ACK
kallewoof force-pushed on Jun 16, 2020Sjors commented at 10:05 AM on June 16, 2020: memberre-tACK a9ad35d3016d9d912472861895b8f5160e24cc12
MarcoFalke referenced this in commit 23b2a68df5 on Jun 16, 2020meshcollider added this to the "PRs" column in a project
69158b41fcadded CURRENCY_ATOM to express minimum indivisible unit
also moved CURRENCY_* into feerate.h file to work around MSVC bug
rpc/wallet: add conf_target as alias to confTarget in bumpfee 91f6d2bc8fkallewoof force-pushed on Jun 20, 2020kallewoof commented at 6:36 AM on June 20, 2020: memberRebased to see if weird FreeBSD error would go away. No changes since a9ad35d
in src/util/fees.cpp:51 in 5ee0e46b93 outdated
53 | 54 | - if (mode == fee_modes.end()) return false; 55 | +std::string FeeModes(const std::string& delimiter) 56 | +{ 57 | + std::string r; 58 | + std::string prefix = "";
jonatack commented at 10:00 AM on June 20, 2020:0ebb85b perhaps use
Join()in util/string.hin src/util/fees.cpp:49 in 5ee0e46b93 outdated
50 | - auto mode = fee_modes.find(mode_string); 51 | + return FEE_MODES; 52 | +} 53 | 54 | - if (mode == fee_modes.end()) return false; 55 | +std::string FeeModes(const std::string& delimiter)
jonatack commented at 8:34 AM on June 21, 2020:0ebb85b8c39668f314d7cc8a2108ec6012bdd3d1 perhaps add
"\"\n\""as a default value fordelimiter
kallewoof commented at 6:55 AM on June 24, 2020:Seems like an odd default, tbh, even though it would reduce code elsewhere.
in test/functional/wallet_basic.py:244 in 5ee0e46b93 outdated
239 | + estimate_mode='bTc/kB', 240 | + ) 241 | + self.nodes[2].generate(1) 242 | + self.sync_all(self.nodes[0:3]) 243 | + node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), explicit_fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex'])) 244 | + assert_equal(self.nodes[2].getbalance(), node_2_bal)
jonatack commented at 8:59 AM on June 21, 2020:69823cc nit (feel free to ignore) if you retouch, can avoid a
getbalancecall here and also lines 270-271 below- node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), explicit_fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex'])) - assert_equal(self.nodes[2].getbalance(), node_2_bal) + balance = self.nodes[2].getbalance() + node_2_bal = self.check_fee_amount(balance, node_2_bal - Decimal('10'), explicit_fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex'])) + assert_equal(balance, node_2_bal)
kallewoof commented at 6:57 AM on June 24, 2020:Done.
in test/functional/wallet_bumpfee.py:127 in 5ee0e46b93 outdated
122 | + }) 123 | + # conf_target and totalFee (depends on -deprecatedrpc=totalFee) 124 | + assert_raises_rpc_error(-3, "Unexpected key totalFee", node.bumpfee, txid, { 125 | + "conf_target": 123, 126 | + "totalFee": 456, 127 | + })
jonatack commented at 9:26 AM on June 21, 2020:69823cc can omit lines 118-127 as the
totalFeeargument is now removed
kallewoof commented at 6:58 AM on June 24, 2020:Thanks, done!
in doc/release-notes-11413.md:9 in 5ee0e46b93 outdated
0 | @@ -0,0 +1,11 @@ 1 | +Updated or changed RPC 2 | +---------------------- 3 | + 4 | +The `bumpfee`, `fundrawtransaction`, `sendmany`, `sendtoaddress`, and `walletcreatefundedpsbt` 5 | +RPC commands have been updated to include two new fee estimation methods "BTC/kB" and "sat/B". 6 | +The target is the fee expressed explicitly in the given form. Note that use of this feature 7 | +will trigger BIP 125 (replace-by-fee) opt-in. 8 | + 9 | +In addition, the estimate_mode parameter is now case insensitive for all of the above RPC commands.
jonatack commented at 9:34 AM on June 21, 2020:5ee0e46 nit: s/estimate_mode/
estimate_mode/in doc/release-notes-11413.md:5 in 5ee0e46b93 outdated
0 | @@ -0,0 +1,11 @@ 1 | +Updated or changed RPC 2 | +---------------------- 3 | + 4 | +The `bumpfee`, `fundrawtransaction`, `sendmany`, `sendtoaddress`, and `walletcreatefundedpsbt` 5 | +RPC commands have been updated to include two new fee estimation methods "BTC/kB" and "sat/B".
jonatack commented at 9:35 AM on June 21, 2020:5ee0e46 nit: missing comma after "methods"
kallewoof commented at 6:59 AM on June 24, 2020:I think it's okay as it is. The methods
aandbwere added.in src/wallet/rpcwallet.cpp:424 in 5ee0e46b93 outdated
420 | @@ -385,6 +421,8 @@ static UniValue sendtoaddress(const JSONRPCRequest& request) 421 | + HelpExampleCli("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\" 0.1 \"donation\" \"seans outpost\"") 422 | + HelpExampleCli("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\" 0.1 \"\" \"\" true") 423 | + HelpExampleRpc("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\", 0.1, \"donation\", \"seans outpost\"") 424 | + + HelpExampleCli("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\" 0.1 \"\" \"\" false true 0.00002 " + (CURRENCY_UNIT + "/kB")) 425 | + + HelpExampleCli("sendtoaddress", "\"" + EXAMPLE_ADDRESS[0] + "\" 0.1 \"\" \"\" false true 2 " + (CURRENCY_ATOM + "/B"))
jonatack commented at 9:43 AM on June 21, 2020:0fb63f0 these two lines should be placed before the
HelpExampleRpcin line 423, as currently the help prints:Examples: > bitcoin-cli sendtoaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 0.1 > bitcoin-cli sendtoaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 0.1 "donation" "seans outpost" > bitcoin-cli sendtoaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 0.1 "" "" true > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "sendtoaddress", "params": ["bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", 0.1, "donation", "seans outpost"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ > bitcoin-cli sendtoaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 0.1 "" "" false true 0.00002 BTC/kB > bitcoin-cli sendtoaddress "bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl" 0.1 "" "" false true 2 sat/B
kallewoof commented at 7:01 AM on June 24, 2020:Good catch, fixed
jonatack commented at 9:52 AM on June 21, 2020: memberACK 5ee0e46b93b2ca41eda9ee46fa59c6834689f0d5
Kudos on your patience on this useful feature. Feel free to ignore the comments below. The RPC examples could be updated (as you've done for sendtoaddress) and the tests could use some cleanup and refactoring, but nothing that can't be done in a follow-up. Happy to re-ACK if you retouch.
fees: add FeeModes doc helper function 5d1a411eb1b188d80c2dMOVEONLY: Make FeeEstimateMode available to CFeeRate
Can verify move-only with: git log -p -n1 --color-moved This commit is move-only and doesn't change code or affect behavior.rpc/wallet: add two explicit modes to estimate_mode 6fcf448430policy: optional FeeEstimateMode param to CFeeRate::ToString 3404c1b75305227a3554tests for bumpfee / estimate_modes
* invalid parameter tests for bumpfee * add tests for no conf_target explicit estimate_modes
doc: add release notes for explicit fee estimators and bumpfee change 25dac9fa65kallewoof force-pushed on Jun 24, 2020jonatack commented at 3:53 PM on June 24, 2020: memberACK 25dac9fa65243ca8db02df2 I think this should be merged after all this time, even though it looks to me like there are needed follow-ups, fixes and test coverage to be added (see further down), which I don't mind helping out with, if wanted.
Summary of the documentation of the changed RPCs:
bumpfee- fee_rate option: "feerate (NOT total fee) to pay, in BTC per kB"
fundrawtransaction- feeRate option: "Set a specific fee rate in BTC/kB"
- fee rate set in conf_target (for BTC/kB or sat/B modes)
sendmany- fee rate set in conf_target: "fee rate (for BTC/kB or sat/B estimate modes)"
sendtoaddress- fee rate set in conf_target: "fee rate (for BTC/kB or sat/B estimate modes)"
walletcreatefundedpsbt- feeRate option: "Set a specific fee rate in BTC/kB"
Thoughts:
I find this pretty confusing and worth harmonizing.
walletcreatefundedpsbtdoes not work withfeeRate+ an explicit estimate mode. Not a surprise given the logic inFundTransaction, wallet/rpcwallet.cpp::3005. Here are added tests inrpc_psbt.pyfrom line 154:
# Existing test. # feeRate of 0.1 BTC / KB produces a total fee slightly below -maxtxfee (~0.05280000): res = self.nodes[1].walletcreatefundedpsbt([{"txid":txid,"vout":p2wpkh_pos},{"txid":txid,"vout":p2sh_p2wpkh_pos},{"txid":txid,"vout":p2pkh_pos}], {self.nodes[1].getnewaddress():29.99}, 0, {"feeRate": 0.1}) assert_greater_than(res["fee"], 0.05) assert_greater_than(0.06, res["fee"]) # Same test using conf_target and estimate_mode btc/kb is green. res = self.nodes[1].walletcreatefundedpsbt( [{"txid":txid,"vout":p2wpkh_pos}, {"txid":txid,"vout":p2sh_p2wpkh_pos}, {"txid":txid,"vout":p2pkh_pos}], {self.nodes[1].getnewaddress():29.99}, 0, { "conf_target": 0.1, "estimate_mode": 'btc/kb', } ) assert_greater_than(res["fee"], 0.05) assert_greater_than(0.06, res["fee"]) # Same test using conf_target and estimate_mode sat/b is green. res = self.nodes[1].walletcreatefundedpsbt( [{"txid":txid,"vout":p2wpkh_pos}, {"txid":txid,"vout":p2sh_p2wpkh_pos}, {"txid":txid,"vout":p2pkh_pos}], {self.nodes[1].getnewaddress():29.99}, 0, { "conf_target": 10000, "estimate_mode": 'sat/b', } ) assert_greater_than(res["fee"], 0.05) assert_greater_than(0.06, res["fee"]) # But the same test using feeRate and estimate_mode btc/kb or # sat/b fails with "Cannot specify both estimate_mode and feeRate". res = self.nodes[1].walletcreatefundedpsbt( [{"txid":txid,"vout":p2wpkh_pos}, {"txid":txid,"vout":p2sh_p2wpkh_pos}, {"txid":txid,"vout":p2pkh_pos}], [{"txid":txid,"vout":p2wpkh_pos}, {"txid":txid,"vout":p2sh_p2wpkh_pos}, {"txid":txid,"vout":p2pkh_pos}], {self.nodes[1].getnewaddress():29.99}, 0, { "feeRate": 10000, "estimate_mode": 'sat/b', } )We need tests for
fundrawtransaction,walletcreatefundedpsbtandbumpfee.We probably need to update the docs or code for
fundrawtransactionandwalletcreatefundedpsbtso thatfeeRatewith an explicit estimation mode either works or is stated as not permitted.
jonatack commented at 7:09 AM on June 25, 2020: memberIf helpful, some notes I took while reviewing this PR: https://gist.github.com/jonatack/f16e51274d4254c01f682063b0f89e04
kallewoof commented at 11:08 AM on June 25, 2020: memberThanks for the detailed review @jonatack! It looks like
bumpfeeis suffering from the same issue aswalletcreatefundedpsbt. I'm totally for merging this and doing a follow-up PR to address those, if this gets enough momentum to finally be merged after all this time. Otherwise I'll look into fixing those two.in src/wallet/rpcwallet.cpp:3297 in 91f6d2bc8f outdated
3293 | @@ -3294,15 +3294,24 @@ static UniValue bumpfee(const JSONRPCRequest& request) 3294 | RPCTypeCheckObj(options, 3295 | { 3296 | {"confTarget", UniValueType(UniValue::VNUM)}, 3297 | + {"conf_target", UniValueType(UniValue::VNUM)},
fjahr commented at 2:06 PM on June 25, 2020:nit: Adding a comment here or below somewhere that this is acting as an alias to
confTargetwould be helpful as well. I have not seen this pattern before and I am pretty sure it would confuse me. maybe in the line above:{"confTarget", UniValueType(UniValue::VNUM)}, // deprecated alias for conf_targetin test/functional/wallet_bumpfee.py:153 in 05227a3554 outdated
149 | @@ -127,9 +150,10 @@ def test_feerate_args(self, rbf_node, peer_node, dest_address): 150 | self.sync_mempools((rbf_node, peer_node)) 151 | assert rbfid in rbf_node.getrawmempool() and rbfid in peer_node.getrawmempool() 152 | 153 | - 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}) 154 | + assert_raises_rpc_error(-8, "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.", rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL, "confTarget": 1})
fjahr commented at 3:13 PM on June 25, 2020:same below.
assert_raises_rpc_error(-8, "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.", rbf_node.bumpfee, rbfid, {"fee_rate": NORMAL, "conf_target": 1})fjahr approvedfjahr commented at 3:39 PM on June 25, 2020: memberCode review ACK 25dac9fa65243ca8db02df22f484039c08114401
Just found two additional nits that can be ignored or kept for the follow-up.
Sjors commented at 4:40 PM on June 25, 2020: memberre-utACK 25dac9fa65: rebased, more fancy C++, <img width="842" alt="Schermafbeelding 2020-06-25 om 18 37 03" src="https://user-images.githubusercontent.com/10217/85761269-e0fa0f00-b712-11ea-90c6-0f1eab891baa.png">
Strong preference for merging this and improving the rest in followups. This has been blocking #16378 for a while and rebasing/tweaking a big change can be a lot of work, also on reviewers.
jonatack commented at 4:47 PM on June 25, 2020: memberOuch, that image with the flashy white background hitting the eyes in dark mode :smile:
Strong preference for merging this and improving the rest in followups. This has been blocking #16378 for a while and rebasing/tweaking a big change can be a lot of work, also on reviewers.
:100:... @kallewoof has the patience of a sphinx. We're still early enough in the release cycle to do the follow-ups.
MarcoFalke commented at 5:55 PM on June 25, 2020: memberSorry to be so late with this review, but it seems that this overloads the
conf_targetwhich used to be an integer (number of blocks) to also accept floats or strings. Then, if a float or string is passed, its unit is taken from the estimate mode (which used to be an enum string).I believe, in the past all amounts (with a few exceptions) were passed as BTC and all feerates were passed as BTC/kB. If we start making feerates more type safe by forcing unit to be passed, then we should come up with a method that works for the whole code base and the whole RPC interface, not only for the few RPCs that happen to have two RPCArgs that can be recycled into passing a new type. For example, in the future one could imagine an RPC to set the feefilter of a peer or to set the mempool min fee or simply
settxfeewould be updated to allow passing a type-safe feerate. Then having multiple ways to pass a feerate would be confusing and added complexity at the call site.Also, passing the feerate (float) as an argument that used to be an integer is going to ask for mishaps, no?
While this is obviously an improvement, and I don't want to block it, I also think that we should aim to get the RPC interface right the very first time, since it is impossible to change after release and hard to change in future releases.
laanwj merged this on Jun 25, 2020laanwj closed this on Jun 25, 2020MarcoFalke commented at 6:00 PM on June 25, 2020: memberOh, looks like this got merged before I left my comment.
Anyway, I'd like to hear what the reviewers think of adding a new
feerateargument that simply passed the feerate (with unit) in one string. Then, parsing code could be shared among all places in the RPC code that use the new feerate type.instagibbs commented at 6:13 PM on June 25, 2020: memberI suggested that a long time ago but iirc people didn't like that idea...
On Thu, Jun 25, 2020, 2:00 PM MarcoFalke notifications@github.com wrote:
Oh, looks like this got merged before I left my comment.
Anyway, I'd like to hear what the reviewers think of adding a new feerate argument that simply passed the feerate (with unit) in one string. Then, parsing code could be shared among all places in the RPC code that use the new feerate type.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/11413#issuecomment-649733071, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMAFU3BKIFRU27KYLBKMELRYOGDXANCNFSM4D43FZIA .
laanwj commented at 6:18 PM on June 25, 2020: memberAnyway, I'd like to hear what the reviewers think of adding a new feerate argument that simply passed the feerate (with unit) in one string. Then, parsing code could be shared among all places in the RPC code that use the new feerate type.
I do agree that this would be better defined. Overloading an argument on type seems somewhat brittle, and could lead to serious accidents. Sorry for merging I thought there was agreement.
MarcoFalke commented at 6:20 PM on June 25, 2020: memberYeah, no worries. I was about to merge this myself just now when I realized that this might not play out well long-term.
jonatack commented at 8:16 PM on June 25, 2020: memberI also prefer not overloading the argument. From reading the years of discussion I thought the discussion had been settled and that ship had sailed. In any case, there's work to do before it is release-ready and I'm happy to help.
MarcoFalke commented at 11:58 PM on June 25, 2020: memberI am happy to review any follow-ups, so please ping me if I don't show up on my own
kallewoof deleted the branch on Jun 26, 2020jonatack commented at 7:20 AM on June 26, 2020: member@kallewoof SGTM. Fixups + tests now, then propose a universal feerate arg unless you want to jump on that.
kallewoof commented at 7:55 AM on June 26, 2020: memberGo for it! :) Let me know if it becomes overwhelming and I'll see if I can pick up a part of it.
sidhujag referenced this in commit 437a0f8e4c on Jul 7, 2020meshcollider moved this from the "PRs" to the "Done" column in a project
meshcollider referenced this in commit ffaac6e614 on Sep 15, 2020sidhujag referenced this in commit 2d9d86f6b8 on Sep 15, 2020meshcollider referenced this in commit 5d32009f1a on Nov 4, 2020MarcoFalke referenced this in commit 80e32e120e on Nov 17, 2020luke-jr referenced this in commit b42abc5205 on Jan 28, 2021luke-jr referenced this in commit 150cf3a221 on Jan 28, 2021luke-jr referenced this in commit d495224d9d on Jan 28, 2021luke-jr referenced this in commit 486ab46c65 on Oct 10, 2021luke-jr referenced this in commit cbb22a4c92 on Oct 10, 2021luke-jr referenced this in commit 56553e0d43 on Oct 10, 2021DrahtBot locked this on Feb 15, 2022ContributorsLinked (view graph)#16378 The ultimate send RPC#16566 util: refactor upper/lowercase functions#18275 wallet: error if an explicit fee rate was given but the needed fee rate differed#19543 Normalize fee units for RPC ("BTC/kB" and "sat/B)#20220 wallet, rpc: explicit fee rate follow-ups/fixes for 0.21#20305 wallet: introduce fee_rate sat/vB param/option
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 18:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me