Skip to content

Commit 2e235b4

Browse files
UdjinM6PastaPastaPasta
authored andcommitted
Fix rpcs
1 parent 00052aa commit 2e235b4

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA
402402
CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
403403
vecSend.push_back(recipient);
404404
if (!pwallet->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet,
405-
strError, nullptr, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, coin_control)) {
405+
strError, coin_control, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS)) {
406406
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance)
407407
strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
408408
throw JSONRPCError(RPC_WALLET_ERROR, strError);
@@ -477,21 +477,21 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
477477

478478
CCoinControl coin_control;
479479

480+
bool fUsePrivateSend = false;
480481
if (request.params.size() > 6 && !request.params[6].isNull()) {
481-
coin_control.nConfirmTarget = request.params[6].get_int();
482+
fUsePrivateSend = request.params[6].get_bool();
482483
}
483484

484485
if (request.params.size() > 7 && !request.params[7].isNull()) {
485-
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
486+
coin_control.nConfirmTarget = request.params[7].get_int();
487+
}
488+
489+
if (request.params.size() > 8 && !request.params[8].isNull()) {
490+
if (!FeeModeFromString(request.params[8].get_str(), coin_control.m_fee_mode)) {
486491
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
487492
}
488493
}
489494

490-
491-
bool fUsePrivateSend = false;
492-
if (request.params.size() > 6)
493-
fUsePrivateSend = request.params[6].get_bool();
494-
495495
EnsureWalletIsUnlocked(pwallet);
496496

497497
SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, fUsePrivateSend, &coin_control);
@@ -984,7 +984,7 @@ UniValue sendmany(const JSONRPCRequest& request)
984984

985985
if (request.fHelp || request.params.size() < 2 || request.params.size() > 8)
986986
throw std::runtime_error(
987-
"sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" [\"address\",...] conf_target \"estimate_mode\")\n"
987+
"sendmany \"fromaccount\" {\"address\":amount,...} ( minconf addlocked \"comment\" [\"address\",...] subtractfeefrom use_is use_ps conf_target \"estimate_mode\")\n"
988988
"\nSend multiple times. Amounts are double-precision floating point numbers."
989989
+ HelpRequiringPassphrase(pwallet) + "\n"
990990
"\nArguments:\n"
@@ -1048,12 +1048,17 @@ UniValue sendmany(const JSONRPCRequest& request)
10481048

10491049
CCoinControl coin_control;
10501050

1051-
if (request.params.size() > 6 && !request.params[6].isNull()) {
1052-
coin_control.nConfirmTarget = request.params[6].get_int();
1051+
bool fUsePrivateSend = false;
1052+
if (request.params.size() > 7 && !request.params[7].isNull()) {
1053+
fUsePrivateSend = request.params[7].get_bool();
10531054
}
10541055

1055-
if (request.params.size() > 7 && !request.params[7].isNull()) {
1056-
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
1056+
if (request.params.size() > 8 && !request.params[8].isNull()) {
1057+
coin_control.nConfirmTarget = request.params[8].get_int();
1058+
}
1059+
1060+
if (request.params.size() > 9 && !request.params[9].isNull()) {
1061+
if (!FeeModeFromString(request.params[9].get_str(), coin_control.m_fee_mode)) {
10571062
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
10581063
}
10591064
}
@@ -1102,12 +1107,9 @@ UniValue sendmany(const JSONRPCRequest& request)
11021107
CAmount nFeeRequired = 0;
11031108
int nChangePosRet = -1;
11041109
std::string strFailReason;
1105-
bool fUsePrivateSend = false;
1106-
if (request.params.size() > 7)
1107-
fUsePrivateSend = request.params[7].get_bool();
11081110

11091111
bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason,
1110-
nullptr, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS, &coin_control);
1112+
&coin_control, true, fUsePrivateSend ? ONLY_DENOMINATED : ALL_COINS);
11111113
if (!fCreated)
11121114
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
11131115
CValidationState state;
@@ -3187,8 +3189,8 @@ static const CRPCCommand commands[] =
31873189
{ "wallet", "lockunspent", &lockunspent, true, {"unlock","transactions"} },
31883190
{ "wallet", "move", &movecmd, false, {"fromaccount","toaccount","amount","minconf","comment"} },
31893191
{ "wallet", "sendfrom", &sendfrom, false, {"fromaccount","toaddress","amount","minconf","addlocked","comment","comment_to"} },
3190-
{ "wallet", "sendmany", &sendmany, false, {"fromaccount","amounts","minconf","addlocked","comment","subtractfeefrom","conf_target","estimate_mode"} },
3191-
{ "wallet", "sendtoaddress", &sendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount","conf_target","estimate_mode"} },
3192+
{ "wallet", "sendmany", &sendmany, false, {"fromaccount","amounts","minconf","addlocked","comment","subtractfeefrom","use_ps","conf_target","estimate_mode"} },
3193+
{ "wallet", "sendtoaddress", &sendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount","use_ps","conf_target","estimate_mode"} },
31923194
{ "wallet", "setaccount", &setaccount, true, {"address","account"} },
31933195
{ "wallet", "settxfee", &settxfee, true, {"amount"} },
31943196
{ "wallet", "setprivatesendrounds", &setprivatesendrounds, true, {"rounds"} },

0 commit comments

Comments
 (0)