@@ -197,25 +197,23 @@ static std::string LabelFromValue(const UniValue& value)
197
197
/* *
198
198
* Update coin control with fee estimation based on the given parameters
199
199
*
200
- * @param[in] pwallet Wallet pointer
200
+ * @param[in] wallet Wallet reference
201
201
* @param[in,out] cc Coin control to be updated
202
202
* @param[in] conf_target UniValue integer; confirmation target in blocks, values between 1 and 1008 are valid per policy/fees.h;
203
- * if a fee_rate is present, 0 is allowed here as a no-op positional placeholder
204
203
* @param[in] estimate_mode UniValue string; fee estimation mode, valid values are "unset", "economical" or "conservative";
205
- * if a fee_rate is present, "" is allowed here as a no-op positional placeholder
206
204
* @param[in] fee_rate UniValue real; fee rate in sat/vB;
207
- * if a fee_rate is present, both conf_target and estimate_mode must either be null, or no-op
205
+ * if present, both conf_target and estimate_mode must either be null, or "unset"
208
206
* @param[in] override_min_fee bool; whether to set fOverrideFeeRate to true to disable minimum fee rate checks and instead
209
207
* verify only that fee_rate is greater than 0
210
208
* @throws a JSONRPCError if conf_target, estimate_mode, or fee_rate contain invalid values or are in conflict
211
209
*/
212
- static void SetFeeEstimateMode (const CWallet* pwallet , CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
210
+ static void SetFeeEstimateMode (const CWallet& wallet , CCoinControl& cc, const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, bool override_min_fee)
213
211
{
214
212
if (!fee_rate.isNull ()) {
215
- if (!conf_target.isNull () && conf_target. get_int () > 0 ) {
213
+ if (!conf_target.isNull ()) {
216
214
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." );
217
215
}
218
- if (!estimate_mode.isNull () && ! estimate_mode.get_str (). empty () ) {
216
+ if (!estimate_mode.isNull () && estimate_mode.get_str () != " unset " ) {
219
217
throw JSONRPCError (RPC_INVALID_PARAMETER, " Cannot specify both estimate_mode and fee_rate" );
220
218
}
221
219
cc.m_feerate = CFeeRate (AmountFromValue (fee_rate), COIN);
@@ -228,7 +226,7 @@ static void SetFeeEstimateMode(const CWallet* pwallet, CCoinControl& cc, const U
228
226
throw JSONRPCError (RPC_INVALID_PARAMETER, InvalidEstimateModeErrorMessage ());
229
227
}
230
228
if (!conf_target.isNull ()) {
231
- cc.m_confirm_target = ParseConfirmTarget (conf_target, pwallet-> chain ().estimateMaxBlocks ());
229
+ cc.m_confirm_target = ParseConfirmTarget (conf_target, wallet. chain ().estimateMaxBlocks ());
232
230
}
233
231
}
234
232
@@ -466,8 +464,8 @@ static RPCHelpMan sendtoaddress()
466
464
+ HelpExampleCli (" sendtoaddress" , " \" " + EXAMPLE_ADDRESS[0 ] + " \" 0.1" ) +
467
465
" \n Send 0.1 BTC with a confirmation target of 6 blocks in economical fee estimate mode using positional arguments\n "
468
466
+ HelpExampleCli (" sendtoaddress" , " \" " + EXAMPLE_ADDRESS[0 ] + " \" 0.1 \" donation\" \" sean's outpost\" false true 6 economical" ) +
469
- " \n Send 0.1 BTC with a fee rate of 1 " + CURRENCY_ATOM + " /vB, subtract fee from amount, BIP125-replaceable, using positional arguments\n "
470
- + HelpExampleCli (" sendtoaddress" , " \" " + EXAMPLE_ADDRESS[0 ] + " \" 0.1 \" drinks\" \" room77\" true true 0 \"\" 1" ) +
467
+ " \n Send 0.1 BTC with a fee rate of 1.1 " + CURRENCY_ATOM + " /vB, subtract fee from amount, BIP125-replaceable, using positional arguments\n "
468
+ + HelpExampleCli (" sendtoaddress" , " \" " + EXAMPLE_ADDRESS[0 ] + " \" 0.1 \" drinks\" \" room77\" true true null \" unset \" null 1. 1" ) +
471
469
" \n Send 0.2 BTC with a confirmation target of 6 blocks in economical fee estimate mode using named arguments\n "
472
470
+ HelpExampleCli (" -named sendtoaddress" , " address=\" " + EXAMPLE_ADDRESS[0 ] + " \" amount=0.2 conf_target=6 estimate_mode=\" economical\" " ) +
473
471
" \n Send 0.5 BTC with a fee rate of 25 " + CURRENCY_ATOM + " /vB using named arguments\n "
@@ -507,7 +505,7 @@ static RPCHelpMan sendtoaddress()
507
505
// We also enable partial spend avoidance if reuse avoidance is set.
508
506
coin_control.m_avoid_partial_spends |= coin_control.m_avoid_address_reuse ;
509
507
510
- SetFeeEstimateMode (pwallet, coin_control, /* conf_target */ request.params [6 ], /* estimate_mode */ request.params [7 ], /* fee_rate */ request.params [9 ], /* override_min_fee */ false );
508
+ SetFeeEstimateMode (* pwallet, coin_control, /* conf_target */ request.params [6 ], /* estimate_mode */ request.params [7 ], /* fee_rate */ request.params [9 ], /* override_min_fee */ false );
511
509
512
510
EnsureWalletIsUnlocked (pwallet);
513
511
@@ -935,7 +933,7 @@ static RPCHelpMan sendmany()
935
933
coin_control.m_signal_bip125_rbf = request.params [5 ].get_bool ();
936
934
}
937
935
938
- SetFeeEstimateMode (pwallet, coin_control, /* conf_target */ request.params [6 ], /* estimate_mode */ request.params [7 ], /* fee_rate */ request.params [8 ], /* override_min_fee */ false );
936
+ SetFeeEstimateMode (* pwallet, coin_control, /* conf_target */ request.params [6 ], /* estimate_mode */ request.params [7 ], /* fee_rate */ request.params [8 ], /* override_min_fee */ false );
939
937
940
938
std::vector<CRecipient> recipients;
941
939
ParseRecipients (sendTo, subtractFeeFromAmount, recipients);
@@ -3159,7 +3157,7 @@ void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& f
3159
3157
if (options.exists (" replaceable" )) {
3160
3158
coinControl.m_signal_bip125_rbf = options[" replaceable" ].get_bool ();
3161
3159
}
3162
- SetFeeEstimateMode (pwallet, coinControl, options[" conf_target" ], options[" estimate_mode" ], options[" fee_rate" ], override_min_fee);
3160
+ SetFeeEstimateMode (* pwallet, coinControl, options[" conf_target" ], options[" estimate_mode" ], options[" fee_rate" ], override_min_fee);
3163
3161
}
3164
3162
} else {
3165
3163
// if options is null and not a bool
@@ -3487,7 +3485,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name)
3487
3485
if (options.exists (" replaceable" )) {
3488
3486
coin_control.m_signal_bip125_rbf = options[" replaceable" ].get_bool ();
3489
3487
}
3490
- SetFeeEstimateMode (pwallet, coin_control, conf_target, options[" estimate_mode" ], options[" fee_rate" ], /* override_min_fee */ false );
3488
+ SetFeeEstimateMode (* pwallet, coin_control, conf_target, options[" estimate_mode" ], options[" fee_rate" ], /* override_min_fee */ false );
3491
3489
}
3492
3490
3493
3491
// Make sure the results are valid at least up to the most recent block
@@ -4076,10 +4074,10 @@ static RPCHelpMan send()
4076
4074
RPCExamples{" "
4077
4075
" \n Send 0.1 BTC with a confirmation target of 6 blocks in economical fee estimate mode\n "
4078
4076
+ HelpExampleCli (" send" , " '{\" " + EXAMPLE_ADDRESS[0 ] + " \" : 0.1}' 6 economical\n " ) +
4079
- " Send 0.2 BTC with a fee rate of 1 " + CURRENCY_ATOM + " /vB using positional arguments\n "
4080
- + HelpExampleCli (" send" , " '{\" " + EXAMPLE_ADDRESS[0 ] + " \" : 0.2}' 0 \"\" 1\n " ) +
4077
+ " Send 0.2 BTC with a fee rate of 1.1 " + CURRENCY_ATOM + " /vB using positional arguments\n "
4078
+ + HelpExampleCli (" send" , " '{\" " + EXAMPLE_ADDRESS[0 ] + " \" : 0.2}' null \" unset \" 1. 1\n " ) +
4081
4079
" Send 0.2 BTC with a fee rate of 1 " + CURRENCY_ATOM + " /vB using the options argument\n "
4082
- + HelpExampleCli (" send" , " '{\" " + EXAMPLE_ADDRESS[0 ] + " \" : 0.2}' '{\" fee_rate\" : 1}'\n " ) +
4080
+ + HelpExampleCli (" send" , " '{\" " + EXAMPLE_ADDRESS[0 ] + " \" : 0.2}' null \" unset \" null '{\" fee_rate\" : 1}'\n " ) +
4083
4081
" Send 0.3 BTC with a fee rate of 25 " + CURRENCY_ATOM + " /vB using named arguments\n "
4084
4082
+ HelpExampleCli (" -named send" , " outputs='{\" " + EXAMPLE_ADDRESS[0 ] + " \" : 0.3}' fee_rate=25\n " ) +
4085
4083
" Create a transaction that should confirm the next block, with a specific input, and return result without adding to wallet or broadcasting to the network\n "
0 commit comments