@@ -374,7 +374,7 @@ UniValue getaddressesbyaccount(const JSONRPCRequest& request)
374374 return ret;
375375}
376376
377- static void SendMoney (CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount , CWalletTx& wtxNew, bool fUsePrivateSend = false )
377+ static void SendMoney (CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount , CWalletTx& wtxNew, bool fUsePrivateSend = false , CCoinControl *coin_control = nullptr )
378378{
379379 CAmount curBalance = pwallet->GetBalance ();
380380
@@ -401,7 +401,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA
401401 CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount };
402402 vecSend.push_back (recipient);
403403 if (!pwallet->CreateTransaction (vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet,
404- strError, nullptr , true , fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS)) {
404+ strError, nullptr , true , fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, coin_control )) {
405405 if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance)
406406 strError = strprintf (" Error: This transaction requires a transaction fee of at least %s" , FormatMoney (nFeeRequired));
407407 throw JSONRPCError (RPC_WALLET_ERROR, strError);
@@ -420,9 +420,9 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
420420 return NullUniValue;
421421 }
422422
423- if (request.fHelp || request.params .size () < 2 || request.params .size () > 7 )
423+ if (request.fHelp || request.params .size () < 2 || request.params .size () > 9 )
424424 throw std::runtime_error (
425- " sendtoaddress \" address\" amount ( \" comment\" \" comment_to\" subtractfeefromamount use_is use_ps )\n "
425+ " sendtoaddress \" address\" amount ( \" comment\" \" comment_to\" subtractfeefromamount use_is use_ps conf_target \" estimate_mode \" )\n "
426426 " \n Send an amount to a given address.\n "
427427 + HelpRequiringPassphrase (pwallet) +
428428 " \n Arguments:\n "
@@ -437,6 +437,11 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
437437 " The recipient will receive less amount of Dash than you enter in the amount field.\n "
438438 " 6. \" use_is\" (bool, optional, default=false) Deprecated and ignored\n "
439439 " 7. \" use_ps\" (bool, optional, default=false) Use anonymized funds only\n "
440+ " 8. conf_target (numeric, optional) Confirmation target (in blocks)\n "
441+ " 9. \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
442+ " \" UNSET\"\n "
443+ " \" ECONOMICAL\"\n "
444+ " \" CONSERVATIVE\"\n "
440445 " \n Result:\n "
441446 " \" txid\" (string) The transaction id.\n "
442447 " \n Examples:\n "
@@ -465,16 +470,33 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
465470 wtx.mapValue [" to" ] = request.params [3 ].get_str ();
466471
467472 bool fSubtractFeeFromAmount = false ;
468- if (request.params .size () > 4 )
473+ if (request.params .size () > 4 && !request. params [ 4 ]. isNull ()) {
469474 fSubtractFeeFromAmount = request.params [4 ].get_bool ();
475+ }
476+
477+ CCoinControl coin_control;
478+ if (request.params .size () > 5 && !request.params [5 ].isNull ()) {
479+ coin_control.signalRbf = request.params [5 ].get_bool ();
480+ }
481+
482+ if (request.params .size () > 6 && !request.params [6 ].isNull ()) {
483+ coin_control.nConfirmTarget = request.params [6 ].get_int ();
484+ }
485+
486+ if (request.params .size () > 7 && !request.params [7 ].isNull ()) {
487+ if (!FeeModeFromString (request.params [7 ].get_str (), coin_control.m_fee_mode )) {
488+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
489+ }
490+ }
491+
470492
471493 bool fUsePrivateSend = false ;
472494 if (request.params .size () > 6 )
473495 fUsePrivateSend = request.params [6 ].get_bool ();
474496
475497 EnsureWalletIsUnlocked (pwallet);
476498
477- SendMoney (pwallet, address.Get (), nAmount, fSubtractFeeFromAmount , wtx, fUsePrivateSend );
499+ SendMoney (pwallet, address.Get (), nAmount, fSubtractFeeFromAmount , wtx, fUsePrivateSend , &coin_control );
478500
479501 return wtx.GetHash ().GetHex ();
480502}
@@ -964,7 +986,7 @@ UniValue sendmany(const JSONRPCRequest& request)
964986
965987 if (request.fHelp || request.params .size () < 2 || request.params .size () > 8 )
966988 throw std::runtime_error (
967- " sendmany \" fromaccount\" {\" address\" :amount,...} ( minconf addlocked \" comment\" [\" address\" ,...] subtractfeefrom use_is use_ps )\n "
989+ " sendmany \" fromaccount\" {\" address\" :amount,...} ( minconf \" comment\" [\" address\" ,...] conf_target \" estimate_mode \" )\n "
968990 " \n Send multiple times. Amounts are double-precision floating point numbers."
969991 + HelpRequiringPassphrase (pwallet) + " \n "
970992 " \n Arguments:\n "
@@ -987,7 +1009,12 @@ UniValue sendmany(const JSONRPCRequest& request)
9871009 " ]\n "
9881010 " 7. \" use_is\" (bool, optional, default=false) Deprecated and ignored\n "
9891011 " 8. \" use_ps\" (bool, optional, default=false) Use anonymized funds only\n "
990- " \n Result:\n "
1012+ " 9. conf_target (numeric, optional) Confirmation target (in blocks)\n "
1013+ " 10. \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
1014+ " \" UNSET\"\n "
1015+ " \" ECONOMICAL\"\n "
1016+ " \" CONSERVATIVE\"\n "
1017+ " \n Result:\n "
9911018 " \" txid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n "
9921019 " the number of addresses.\n "
9931020 " \n Examples:\n "
@@ -1018,9 +1045,24 @@ UniValue sendmany(const JSONRPCRequest& request)
10181045 wtx.mapValue [" comment" ] = request.params [4 ].get_str ();
10191046
10201047 UniValue subtractFeeFrom (UniValue::VARR);
1021- if (request.params .size () > 5 )
1048+ if (request.params .size () > 5 && !request. params [ 5 ]. isNull () )
10221049 subtractFeeFrom = request.params [5 ].get_array ();
10231050
1051+ CCoinControl coin_control;
1052+ if (request.params .size () > 5 && !request.params [5 ].isNull ()) {
1053+ coin_control.signalRbf = request.params [5 ].get_bool ();
1054+ }
1055+
1056+ if (request.params .size () > 6 && !request.params [6 ].isNull ()) {
1057+ coin_control.nConfirmTarget = request.params [6 ].get_int ();
1058+ }
1059+
1060+ if (request.params .size () > 7 && !request.params [7 ].isNull ()) {
1061+ if (!FeeModeFromString (request.params [7 ].get_str (), coin_control.m_fee_mode )) {
1062+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
1063+ }
1064+ }
1065+
10241066 std::set<CBitcoinAddress> setAddress;
10251067 std::vector<CRecipient> vecSend;
10261068
@@ -1070,7 +1112,7 @@ UniValue sendmany(const JSONRPCRequest& request)
10701112 fUsePrivateSend = request.params [7 ].get_bool ();
10711113
10721114 bool fCreated = pwallet->CreateTransaction (vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason,
1073- nullptr , true , fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS);
1115+ nullptr , true , fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, &coin_control );
10741116 if (!fCreated )
10751117 throw JSONRPCError (RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
10761118 CValidationState state;
@@ -2887,6 +2929,11 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
28872929 " Those recipients will receive less dash than you enter in their corresponding amount field.\n "
28882930 " If no outputs are specified here, the sender pays the fee.\n "
28892931 " [vout_index,...]\n "
2932+ " \" conf_target\" (numeric, optional) Confirmation target (in blocks)\n "
2933+ " \" estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n "
2934+ " \" UNSET\"\n "
2935+ " \" ECONOMICAL\"\n "
2936+ " \" CONSERVATIVE\"\n "
28902937 " }\n "
28912938 " for backward compatibility: passing in a true instead of an object will result in {\" includeWatching\" :true}\n "
28922939 " \n Result:\n "
@@ -2937,6 +2984,8 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
29372984 {" reserveChangeKey" , UniValueType (UniValue::VBOOL)},
29382985 {" feeRate" , UniValueType ()}, // will be checked below
29392986 {" subtractFeeFromOutputs" , UniValueType (UniValue::VARR)},
2987+ {" conf_target" , UniValueType (UniValue::VNUM)},
2988+ {" estimate_mode" , UniValueType (UniValue::VSTR)},
29402989 },
29412990 true , true );
29422991
@@ -2969,6 +3018,14 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
29693018
29703019 if (options.exists (" subtractFeeFromOutputs" ))
29713020 subtractFeeFromOutputs = options[" subtractFeeFromOutputs" ].get_array ();
3021+ if (options.exists (" conf_target" )) {
3022+ coinControl.nConfirmTarget = options[" conf_target" ].get_int ();
3023+ }
3024+ if (options.exists (" estimate_mode" )) {
3025+ if (!FeeModeFromString (options[" estimate_mode" ].get_str (), coinControl.m_fee_mode )) {
3026+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
3027+ }
3028+ }
29723029 }
29733030 }
29743031
@@ -3134,8 +3191,8 @@ static const CRPCCommand commands[] =
31343191 { " wallet" , " lockunspent" , &lockunspent, true , {" unlock" ," transactions" } },
31353192 { " wallet" , " move" , &movecmd, false , {" fromaccount" ," toaccount" ," amount" ," minconf" ," comment" } },
31363193 { " wallet" , " sendfrom" , &sendfrom, false , {" fromaccount" ," toaddress" ," amount" ," minconf" ," addlocked" ," comment" ," comment_to" } },
3137- { " wallet" , " sendmany" , &sendmany, false , {" fromaccount" ," amounts" ," minconf" ," addlocked" ," comment" ," subtractfeefrom" } },
3138- { " wallet" , " sendtoaddress" , &sendtoaddress, false , {" address" ," amount" ," comment" ," comment_to" ," subtractfeefromamount" } },
3194+ { " wallet" , " sendmany" , &sendmany, false , {" fromaccount" ," amounts" ," minconf" ," addlocked" ," comment" ," subtractfeefrom" , " replaceable " , " conf_target " , " estimate_mode " } },
3195+ { " wallet" , " sendtoaddress" , &sendtoaddress, false , {" address" ," amount" ," comment" ," comment_to" ," subtractfeefromamount" , " conf_target " , " estimate_mode " } },
31393196 { " wallet" , " setaccount" , &setaccount, true , {" address" ," account" } },
31403197 { " wallet" , " settxfee" , &settxfee, true , {" amount" } },
31413198 { " wallet" , " setprivatesendrounds" , &setprivatesendrounds, true , {" rounds" } },
0 commit comments