Skip to content

Commit 2987ba6

Browse files
committed
Merge bitcoin#30525: doc, rpc : bitcoin#30275 followups
fa2f269 [rpc, fees]: add more detail on the fee estimation modes (ismaelsadeeq) 6e7e620 [doc]: add `30275` release notes (ismaelsadeeq) Pull request description: This PR: 1. Adds release notes for bitcoin#30275 2. Describe fee estimation modes in RPC help texts ACKs for top commit: achow101: ACK fa2f269 glozow: ACK fa2f269 willcl-ark: ACK fa2f269 tdb3: re ACK fa2f269 Tree-SHA512: b8ea000b599297b954dc770137c29b47153e68644c58550a73e34b74ecb8b65e78417875481efdfdf6aab0018a9cd1d90d8baa5a015e70aca0975f6e1dc9598c
2 parents b38fb19 + fa2f269 commit 2987ba6

File tree

5 files changed

+46
-14
lines changed

5 files changed

+46
-14
lines changed

doc/release-notes-30275.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
RPC
2+
---
3+
4+
- The default mode for the `estimatesmartfee` RPC has been updated from `conservative` to `economical`.
5+
which is expected to reduce overestimation for many users, particularly if Replace-by-Fee is an option.
6+
For users that require high confidence in their fee estimates at the cost of potentially overestimating,
7+
the `conservative` mode remains available.

src/common/messages.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,34 @@ const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap()
5353
return FEE_MODES;
5454
}
5555

56+
std::string FeeModeInfo(const std::pair<std::string, FeeEstimateMode>& mode, std::string& default_info)
57+
{
58+
switch (mode.second) {
59+
case FeeEstimateMode::UNSET:
60+
return strprintf("%s means no mode set (%s). \n", mode.first, default_info);
61+
case FeeEstimateMode::ECONOMICAL:
62+
return strprintf("%s estimates use a shorter time horizon, making them more\n"
63+
"responsive to short-term drops in the prevailing fee market. This mode\n"
64+
"potentially returns a lower fee rate estimate.\n", mode.first);
65+
case FeeEstimateMode::CONSERVATIVE:
66+
return strprintf("%s estimates use a longer time horizon, making them\n"
67+
"less responsive to short-term drops in the prevailing fee market. This mode\n"
68+
"potentially returns a higher fee rate estimate.\n", mode.first);
69+
default:
70+
// Other modes apart from the ones handled are fee rate units; they should not be clarified.
71+
assert(false);
72+
}
73+
}
74+
75+
std::string FeeModesDetail(std::string default_info)
76+
{
77+
std::string info;
78+
for (const auto& fee_mode : FeeModeMap()) {
79+
info += FeeModeInfo(fee_mode, default_info);
80+
}
81+
return strprintf("%s \n%s", FeeModes(", "), info);
82+
}
83+
5684
std::string FeeModes(const std::string& delimiter)
5785
{
5886
return Join(FeeModeMap(), delimiter, [&](const std::pair<std::string, FeeEstimateMode>& i) { return i.first; });

src/common/messages.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ enum class PSBTError;
2626
bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode);
2727
std::string StringForFeeReason(FeeReason reason);
2828
std::string FeeModes(const std::string& delimiter);
29+
std::string FeeModeInfo(std::pair<std::string, FeeEstimateMode>& mode);
30+
std::string FeeModesDetail(std::string default_info);
2931
std::string InvalidEstimateModeErrorMessage();
3032
bilingual_str PSBTErrorString(PSBTError error);
3133
bilingual_str TransactionErrorString(const node::TransactionError error);

src/rpc/fees.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <string>
2424

2525
using common::FeeModeFromString;
26-
using common::FeeModes;
26+
using common::FeeModesDetail;
2727
using common::InvalidEstimateModeErrorMessage;
2828
using node::NodeContext;
2929

@@ -37,12 +37,7 @@ static RPCHelpMan estimatesmartfee()
3737
{
3838
{"conf_target", RPCArg::Type::NUM, RPCArg::Optional::NO, "Confirmation target in blocks (1 - 1008)"},
3939
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"economical"}, "The fee estimate mode.\n"
40-
"Whether to return a more conservative estimate which also satisfies\n"
41-
"a longer history. A conservative estimate potentially returns a\n"
42-
"higher feerate and is more likely to be sufficient for the desired\n"
43-
"target, but is not as responsive to short term drops in the\n"
44-
"prevailing fee market. Must be one of (case insensitive):\n"
45-
"\"" + FeeModes("\"\n\"") + "\""},
40+
+ FeeModesDetail(std::string("default mode will be used"))},
4641
},
4742
RPCResult{
4843
RPCResult::Type::OBJ, "", "",

src/wallet/rpc/spend.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <univalue.h>
2525

2626
using common::FeeModeFromString;
27-
using common::FeeModes;
27+
using common::FeeModesDetail;
2828
using common::InvalidEstimateModeErrorMessage;
2929
using common::StringForFeeReason;
3030
using common::TransactionErrorString;
@@ -245,7 +245,7 @@ RPCHelpMan sendtoaddress()
245245
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Signal that this transaction can be replaced by a transaction (BIP 125)"},
246246
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
247247
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, "The fee estimate mode, must be one of (case insensitive):\n"
248-
"\"" + FeeModes("\"\n\"") + "\""},
248+
+ FeeModesDetail(std::string("economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used"))},
249249
{"avoid_reuse", RPCArg::Type::BOOL, RPCArg::Default{true}, "(only available if avoid_reuse wallet flag is set) Avoid spending from dirty addresses; addresses are considered\n"
250250
"dirty if they have previously been used in a transaction. If true, this also activates avoidpartialspends, grouping outputs by their addresses."},
251251
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
@@ -349,7 +349,7 @@ RPCHelpMan sendmany()
349349
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Signal that this transaction can be replaced by a transaction (BIP 125)"},
350350
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
351351
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, "The fee estimate mode, must be one of (case insensitive):\n"
352-
"\"" + FeeModes("\"\n\"") + "\""},
352+
+ FeeModesDetail(std::string("economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used"))},
353353
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
354354
{"verbose", RPCArg::Type::BOOL, RPCArg::Default{false}, "If true, return extra information about the transaction."},
355355
},
@@ -463,7 +463,7 @@ static std::vector<RPCArg> FundTxDoc(bool solving_data = true)
463463
std::vector<RPCArg> args = {
464464
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks", RPCArgOptions{.also_positional = true}},
465465
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, "The fee estimate mode, must be one of (case insensitive):\n"
466-
"\"" + FeeModes("\"\n\"") + "\"", RPCArgOptions{.also_positional = true}},
466+
+ FeeModesDetail(std::string("economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used")), RPCArgOptions{.also_positional = true}},
467467
{
468468
"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125-replaceable.\n"
469469
"Allows this transaction to be replaced by a transaction with higher fees"
@@ -1018,7 +1018,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name)
10181018
"still be replaceable in practice, for example if it has unconfirmed ancestors which\n"
10191019
"are replaceable).\n"},
10201020
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, "The fee estimate mode, must be one of (case insensitive):\n"
1021-
"\"" + FeeModes("\"\n\"") + "\""},
1021+
+ FeeModesDetail(std::string("economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used"))},
10221022
{"outputs", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "The outputs specified as key-value pairs.\n"
10231023
"Each key may only appear once, i.e. there can only be one 'data' output, and no address may be duplicated.\n"
10241024
"At least one output of either type must be specified.\n"
@@ -1205,7 +1205,7 @@ RPCHelpMan send()
12051205
RPCArgOptions{.skip_type_check = true}},
12061206
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
12071207
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, "The fee estimate mode, must be one of (case insensitive):\n"
1208-
"\"" + FeeModes("\"\n\"") + "\""},
1208+
+ FeeModesDetail(std::string("economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used"))},
12091209
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
12101210
{"options", RPCArg::Type::OBJ_NAMED_PARAMS, RPCArg::Optional::OMITTED, "",
12111211
Cat<std::vector<RPCArg>>(
@@ -1331,7 +1331,7 @@ RPCHelpMan sendall()
13311331
},
13321332
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
13331333
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, "The fee estimate mode, must be one of (case insensitive):\n"
1334-
"\"" + FeeModes("\"\n\"") + "\""},
1334+
+ FeeModesDetail(std::string("economical mode is used if the transaction is replaceable;\notherwise, conservative mode is used"))},
13351335
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
13361336
{
13371337
"options", RPCArg::Type::OBJ_NAMED_PARAMS, RPCArg::Optional::OMITTED, "",

0 commit comments

Comments
 (0)