diff options
author | Ava Chow <github@achow101.com> | 2024-08-07 01:27:42 -0400 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2024-08-07 01:27:42 -0400 |
commit | 2987ba66375863cdfb0e6065a36c5d3302499c0b (patch) | |
tree | 7346ba55ed81fa94408ebbb42e6df1af4eb0ce55 /src/common | |
parent | b38fb19b7eed952726a8b858de3f0533c867fc90 (diff) | |
parent | fa2f26960ee084971ab09959b213a9b8104482e5 (diff) |
Merge bitcoin/bitcoin#30525: doc, rpc : `#30275` followups
fa2f26960ee084971ab09959b213a9b8104482e5 [rpc, fees]: add more detail on the fee estimation modes (ismaelsadeeq)
6e7e620864cc7a2f3c3b576588afe4d44dc394ec [doc]: add `30275` release notes (ismaelsadeeq)
Pull request description:
This PR:
1. Adds release notes for #30275
2. Describe fee estimation modes in RPC help texts
ACKs for top commit:
achow101:
ACK fa2f26960ee084971ab09959b213a9b8104482e5
glozow:
ACK fa2f26960ee084971ab09959b213a9b8104482e5
willcl-ark:
ACK fa2f26960ee
tdb3:
re ACK fa2f26960ee084971ab09959b213a9b8104482e5
Tree-SHA512: b8ea000b599297b954dc770137c29b47153e68644c58550a73e34b74ecb8b65e78417875481efdfdf6aab0018a9cd1d90d8baa5a015e70aca0975f6e1dc9598c
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/messages.cpp | 28 | ||||
-rw-r--r-- | src/common/messages.h | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/common/messages.cpp b/src/common/messages.cpp index 6a3ebbca67..5fe3e9e4d8 100644 --- a/src/common/messages.cpp +++ b/src/common/messages.cpp @@ -53,6 +53,34 @@ const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap() return FEE_MODES; } +std::string FeeModeInfo(const std::pair<std::string, FeeEstimateMode>& mode, std::string& default_info) +{ + switch (mode.second) { + case FeeEstimateMode::UNSET: + return strprintf("%s means no mode set (%s). \n", mode.first, default_info); + case FeeEstimateMode::ECONOMICAL: + return strprintf("%s estimates use a shorter time horizon, making them more\n" + "responsive to short-term drops in the prevailing fee market. This mode\n" + "potentially returns a lower fee rate estimate.\n", mode.first); + case FeeEstimateMode::CONSERVATIVE: + return strprintf("%s estimates use a longer time horizon, making them\n" + "less responsive to short-term drops in the prevailing fee market. This mode\n" + "potentially returns a higher fee rate estimate.\n", mode.first); + default: + // Other modes apart from the ones handled are fee rate units; they should not be clarified. + assert(false); + } +} + +std::string FeeModesDetail(std::string default_info) +{ + std::string info; + for (const auto& fee_mode : FeeModeMap()) { + info += FeeModeInfo(fee_mode, default_info); + } + return strprintf("%s \n%s", FeeModes(", "), info); +} + std::string FeeModes(const std::string& delimiter) { return Join(FeeModeMap(), delimiter, [&](const std::pair<std::string, FeeEstimateMode>& i) { return i.first; }); diff --git a/src/common/messages.h b/src/common/messages.h index 68e7bb2169..5827fccee0 100644 --- a/src/common/messages.h +++ b/src/common/messages.h @@ -26,6 +26,8 @@ enum class PSBTError; bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode); std::string StringForFeeReason(FeeReason reason); std::string FeeModes(const std::string& delimiter); +std::string FeeModeInfo(std::pair<std::string, FeeEstimateMode>& mode); +std::string FeeModesDetail(std::string default_info); std::string InvalidEstimateModeErrorMessage(); bilingual_str PSBTErrorString(PSBTError error); bilingual_str TransactionErrorString(const node::TransactionError error); |