MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetFeeEstimateMode

Function SetFeeEstimateMode

src/wallet/rpc/spend.cpp:117–139  ·  view source on GitHub ↗

* Update coin control with fee estimation based on the given parameters * * @param[in] wallet Wallet reference * @param[in,out] cc Coin control to be updated * @param[in] conf_target UniValue integer; confirmation target in blocks, values between 1 and 1008 are valid per policy/fees.h; * @param[in] estimate_mode UniValue string; fee estimation m

Source from the content-addressed store, hash-verified

115 * @throws a JSONRPCError if conf_target, estimate_mode, or fee_rate contain invalid values or are in conflict
116 */
117static void SetFeeEstimateMode(const CWallet& wallet, CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
118{
119 if (!fee_rate.isNull()) {
120 if (!conf_target.isNull()) {
121 throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both conf_target and fee_rate. Please provide either a confirmation target in blocks for automatic fee estimation, or an explicit fee rate.");
122 }
123 if (!estimate_mode.isNull() && estimate_mode.get_str() != "unset") {
124 throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and fee_rate");
125 }
126 // Fee rates in sat/vB cannot represent more than 3 significant digits.
127 cc.m_feerate = CFeeRate{AmountFromValue(fee_rate, /*check_range=*/true, /*decimals=*/3)};
128 if (override_min_fee) cc.fOverrideFeeRate = true;
129 // Default RBF to true for explicit fee_rate, if unset.
130 if (!cc.m_signal_bip125_rbf) cc.m_signal_bip125_rbf = true;
131 return;
132 }
133 if (!estimate_mode.isNull() && !FeeModeFromString(estimate_mode.get_str(), cc.m_fee_mode)) {
134 throw JSONRPCError(RPC_INVALID_PARAMETER, InvalidEstimateModeErrorMessage());
135 }
136 if (!conf_target.isNull()) {
137 cc.m_confirm_target = ParseConfirmTarget(conf_target, wallet.chain().estimateMaxBlocks());
138 }
139}
140
141RPCHelpMan sendtoaddress()
142{

Callers 4

sendtoaddressFunction · 0.85
sendmanyFunction · 0.85
FundTransactionFunction · 0.85
bumpfee_helperFunction · 0.85

Calls 7

JSONRPCErrorFunction · 0.85
FeeModeFromStringFunction · 0.85
ParseConfirmTargetFunction · 0.85
estimateMaxBlocksMethod · 0.80
AmountFromValueFunction · 0.50
isNullMethod · 0.45

Tested by

no test coverage detected