@@ -417,7 +417,10 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
417417 " The recipient will receive less bitcoins than you enter in the amount field.\n "
418418 " 6. opt_in_rbf (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees\n "
419419 " 7. conf_target (numeric, optional) Confirmation target (in blocks)\n "
420- " 8. conservative_estimate (boolean, optional) Use conservative (potentially higher) fee estimation\n "
420+ " 8. \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
421+ " \" UNSET\"\n "
422+ " \" ECONOMICAL\"\n "
423+ " \" CONSERVATIVE\"\n "
421424 " \n Result:\n "
422425 " \" txid\" (string) The transaction id.\n "
423426 " \n Examples:\n "
@@ -460,7 +463,12 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
460463 }
461464
462465 if (request.params .size () > 7 && !request.params [7 ].isNull ()) {
463- coin_control.m_fee_mode = request.params [7 ].get_bool () ? FeeEstimateMode::CONSERVATIVE : FeeEstimateMode::ECONOMICAL;
466+ if (boost::optional<FeeEstimateMode> fee_mode = FeeModeForString (request.params [7 ].get_str ())) {
467+ coin_control.m_fee_mode = *fee_mode;
468+ }
469+ else {
470+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
471+ }
464472 }
465473
466474
@@ -929,7 +937,10 @@ UniValue sendmany(const JSONRPCRequest& request)
929937 " ]\n "
930938 " 6. opt_in_rbf (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees\n "
931939 " 7. conf_target (numeric, optional) Confirmation target (in blocks)\n "
932- " 8. conservative_estimate (boolean, optional) Use conservative (potentially higher) fee estimation\n "
940+ " 8. \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
941+ " \" UNSET\"\n "
942+ " \" ECONOMICAL\"\n "
943+ " \" CONSERVATIVE\"\n "
933944 " \n Result:\n "
934945 " \" txid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n "
935946 " the number of addresses.\n "
@@ -975,7 +986,12 @@ UniValue sendmany(const JSONRPCRequest& request)
975986 }
976987
977988 if (request.params .size () > 7 && !request.params [7 ].isNull ()) {
978- coin_control.m_fee_mode = request.params [7 ].get_bool () ? FeeEstimateMode::CONSERVATIVE : FeeEstimateMode::ECONOMICAL;
989+ if (boost::optional<FeeEstimateMode> fee_mode = FeeModeForString (request.params [7 ].get_str ())) {
990+ coin_control.m_fee_mode = *fee_mode;
991+ }
992+ else {
993+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
994+ }
979995 }
980996
981997 std::set<CBitcoinAddress> setAddress;
@@ -2692,7 +2708,10 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
26922708 " [vout_index,...]\n "
26932709 " \" optIntoRbf\" (boolean, optional) Allow this transaction to be replaced by a transaction with higher fees\n "
26942710 " \" conf_target\" (numeric, optional) Confirmation target (in blocks)\n "
2695- " \" conservative_estimate\" (boolean, optional) Use conservative (potentially higher) fee estimation\n "
2711+ " \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
2712+ " \" UNSET\"\n "
2713+ " \" ECONOMICAL\"\n "
2714+ " \" CONSERVATIVE\"\n "
26962715 " }\n "
26972716 " for backward compatibility: passing in a true instead of an object will result in {\" includeWatching\" :true}\n "
26982717 " \n Result:\n "
@@ -2746,7 +2765,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
27462765 {" subtractFeeFromOutputs" , UniValueType (UniValue::VARR)},
27472766 {" optIntoRbf" , UniValueType (UniValue::VBOOL)},
27482767 {" conf_target" , UniValueType (UniValue::VNUM)},
2749- {" conservative_estimate " , UniValueType (UniValue::VBOOL )},
2768+ {" estimate_mode " , UniValueType (UniValue::VSTR )},
27502769 },
27512770 true , true );
27522771
@@ -2786,8 +2805,13 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
27862805 if (options.exists (" conf_target" )) {
27872806 coinControl.nConfirmTarget = options[" conf_target" ].get_int ();
27882807 }
2789- if (options.exists (" conservative_estimate" )) {
2790- coinControl.m_fee_mode = options[" conservative_estimate" ].get_bool () ? FeeEstimateMode::CONSERVATIVE : FeeEstimateMode::ECONOMICAL;
2808+ if (options.exists (" estimate_mode" )) {
2809+ if (boost::optional<FeeEstimateMode> fee_mode = FeeModeForString (options[" estimate_mode" ].get_str ())) {
2810+ coinControl.m_fee_mode = *fee_mode;
2811+ }
2812+ else {
2813+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
2814+ }
27912815 }
27922816 }
27932817 }
@@ -2866,7 +2890,10 @@ UniValue bumpfee(const JSONRPCRequest& request)
28662890 " so the new transaction will not be explicitly bip-125 replaceable (though it may\n "
28672891 " still be replaceable in practice, for example if it has unconfirmed ancestors which\n "
28682892 " are replaceable).\n "
2869- " \" conservative_estimate\" (boolean, optional) Use conservative (potentially higher) fee estimation\n "
2893+ " \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
2894+ " \" UNSET\"\n "
2895+ " \" ECONOMICAL\"\n "
2896+ " \" CONSERVATIVE\"\n "
28702897 " }\n "
28712898 " \n Result:\n "
28722899 " {\n "
@@ -2897,7 +2924,7 @@ UniValue bumpfee(const JSONRPCRequest& request)
28972924 {" confTarget" , UniValueType (UniValue::VNUM)},
28982925 {" totalFee" , UniValueType (UniValue::VNUM)},
28992926 {" replaceable" , UniValueType (UniValue::VBOOL)},
2900- {" conservative_estimate " , UniValueType (UniValue::VBOOL )},
2927+ {" estimate_mode " , UniValueType (UniValue::VSTR )},
29012928 },
29022929 true , true );
29032930
@@ -2922,8 +2949,13 @@ UniValue bumpfee(const JSONRPCRequest& request)
29222949 if (options.exists (" replaceable" )) {
29232950 replaceable = options[" replaceable" ].get_bool ();
29242951 }
2925- if (options.exists (" conservative_estimate" )) {
2926- fee_mode = options[" conservative_estimate" ].get_bool () ? FeeEstimateMode::CONSERVATIVE : FeeEstimateMode::ECONOMICAL;
2952+ if (options.exists (" estimate_mode" )) {
2953+ if (boost::optional<FeeEstimateMode> desired_fee_mode = FeeModeForString (options[" estimate_mode" ].get_str ())) {
2954+ fee_mode = *desired_fee_mode;
2955+ }
2956+ else {
2957+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
2958+ }
29272959 }
29282960 }
29292961
@@ -3027,8 +3059,8 @@ static const CRPCCommand commands[] =
30273059 { " wallet" , " lockunspent" , &lockunspent, true , {" unlock" ," transactions" } },
30283060 { " wallet" , " move" , &movecmd, false , {" fromaccount" ," toaccount" ," amount" ," minconf" ," comment" } },
30293061 { " wallet" , " sendfrom" , &sendfrom, false , {" fromaccount" ," toaddress" ," amount" ," minconf" ," comment" ," comment_to" } },
3030- { " wallet" , " sendmany" , &sendmany, false , {" fromaccount" ," amounts" ," minconf" ," comment" ," subtractfeefrom" ," opt_in_rbf" ," conf_target" ," conservative_estimate " } },
3031- { " wallet" , " sendtoaddress" , &sendtoaddress, false , {" address" ," amount" ," comment" ," comment_to" ," subtractfeefromamount" ," opt_in_rbf" ," conf_target" ," conservative_estimate " } },
3062+ { " wallet" , " sendmany" , &sendmany, false , {" fromaccount" ," amounts" ," minconf" ," comment" ," subtractfeefrom" ," opt_in_rbf" ," conf_target" ," estimate_mode " } },
3063+ { " wallet" , " sendtoaddress" , &sendtoaddress, false , {" address" ," amount" ," comment" ," comment_to" ," subtractfeefromamount" ," opt_in_rbf" ," conf_target" ," estimate_mode " } },
30323064 { " wallet" , " setaccount" , &setaccount, true , {" address" ," account" } },
30333065 { " wallet" , " settxfee" , &settxfee, true , {" amount" } },
30343066 { " wallet" , " signmessage" , &signmessage, true , {" address" ," message" } },
0 commit comments