aboutsummaryrefslogtreecommitdiff
path: root/src/policy
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2017-06-14 15:15:40 -0400
committerAlex Morcos <morcos@chaincode.com>2017-07-10 12:40:02 -0400
commitf135923ee2cf1a1a9a436626dc5b9219f8ad97da (patch)
treeadde79ee8ba6dc1a97167c2b8686b7d59654f9e4 /src/policy
parentf0bf33da8357bd6aff100bbe5b84a7f01937e379 (diff)
Add RPC options for RBF, confirmation target, and conservative fee estimation.
Add support for setting each of these attributes on a per RPC call basis to sendtoaddress, sendmany, fundrawtransaction (already had RBF), and bumpfee (already had RBF and conf target).
Diffstat (limited to 'src/policy')
-rw-r--r--src/policy/fees.cpp14
-rw-r--r--src/policy/fees.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index 771491770e..c39a2d55c3 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -36,6 +36,20 @@ 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},
+ };
+ auto mode = fee_modes.find(mode_string);
+
+ if (mode == fee_modes.end()) return false;
+
+ fee_estimate_mode = mode->second;
+ return true;
+}
+
/**
* We will instantiate an instance of this class to track transactions that were
* included in a block. We will lump transactions into a bucket according to their
diff --git a/src/policy/fees.h b/src/policy/fees.h
index 059415418d..fea279e477 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -97,6 +97,8 @@ enum class FeeEstimateMode {
CONSERVATIVE, //! Force estimateSmartFee to use conservative estimates
};
+bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode);
+
/* Used to return detailed information about a feerate bucket */
struct EstimatorBucket
{