New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wallet] [rpc] sendtoaddress/sendmany: Add explicit feerate option #11413
Changes from all commits
69158b4
91f6d2b
5d1a411
b188d80
6fcf448
3404c1b
05227a3
25dac9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Updated or changed RPC | ||
---------------------- | ||
|
||
The `bumpfee`, `fundrawtransaction`, `sendmany`, `sendtoaddress`, and `walletcreatefundedpsbt` | ||
RPC commands have been updated to include two new fee estimation methods "BTC/kB" and "sat/B". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5ee0e46 nit: missing comma after "methods" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's okay as it is. The methods |
||
The target is the fee expressed explicitly in the given form. Note that use of this feature | ||
will trigger BIP 125 (replace-by-fee) opt-in. | ||
|
||
In addition, the `estimate_mode` parameter is now case insensitive for all of the above RPC commands. | ||
|
||
The `bumpfee` command now uses `conf_target` rather than `confTarget` in the options. | ||
kallewoof marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,16 @@ | |
#include <util/fees.h> | ||
|
||
#include <policy/fees.h> | ||
#include <util/strencodings.h> | ||
#include <util/string.h> | ||
|
||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
#include <utility> | ||
|
||
std::string StringForFeeReason(FeeReason reason) { | ||
std::string StringForFeeReason(FeeReason reason) | ||
{ | ||
static const std::map<FeeReason, std::string> fee_reason_strings = { | ||
{FeeReason::NONE, "None"}, | ||
{FeeReason::HALF_ESTIMATE, "Half Target 60% Threshold"}, | ||
|
@@ -29,16 +34,31 @@ std::string StringForFeeReason(FeeReason reason) { | |
return reason_string->second; | ||
} | ||
|
||
bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) { | ||
static const std::map<std::string, FeeEstimateMode> fee_modes = { | ||
{"UNSET", FeeEstimateMode::UNSET}, | ||
{"ECONOMICAL", FeeEstimateMode::ECONOMICAL}, | ||
{"CONSERVATIVE", FeeEstimateMode::CONSERVATIVE}, | ||
const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap() | ||
{ | ||
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}, | ||
{(CURRENCY_ATOM + "/B"), FeeEstimateMode::SAT_B}, | ||
}; | ||
auto mode = fee_modes.find(mode_string); | ||
return FEE_MODES; | ||
} | ||
|
||
if (mode == fee_modes.end()) return false; | ||
std::string FeeModes(const std::string& delimiter) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0ebb85b perhaps add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like an odd default, tbh, even though it would reduce code elsewhere. |
||
{ | ||
return Join(FeeModeMap(), delimiter, [&](const std::pair<std::string, FeeEstimateMode>& i) { return i.first; }); | ||
} | ||
|
||
fee_estimate_mode = mode->second; | ||
return true; | ||
bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode) | ||
{ | ||
auto searchkey = ToUpper(mode_string); | ||
for (const auto& pair : FeeModeMap()) { | ||
if (ToUpper(pair.first) == searchkey) { | ||
fee_estimate_mode = pair.second; | ||
return true; | ||
} | ||
} | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will also trigger bip125 opt-in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added note.