Skip to content

Commit

Permalink
fix: update index matching in rpcwallet~
Browse files Browse the repository at this point in the history
* Fix indicies to match correct counterparts
* Fix inidices to correct index where index specified does not exist
  • Loading branch information
michaelmcshinsky committed Oct 27, 2023
1 parent c8197cd commit 159bc4a
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,11 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
// }

if (!request.params[5].isNull()) {
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
coin_control.m_confirm_target = ParseConfirmTarget(request.params[5]);
}

if (!request.params[6].isNull()) {
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
if (!FeeModeFromString(request.params[6].get_str(), coin_control.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
Expand Down Expand Up @@ -639,22 +639,26 @@ UniValue sendfromaddress(const JSONRPCRequest& request)

// Wallet comments
CWalletTx wtx;
if (!request.params[3].isNull() && !request.params[2].get_str().empty())
wtx.mapValue["comment"] = request.params[2].get_str();
if (!request.params[4].isNull() && !request.params[3].get_str().empty())
wtx.mapValue["to"] = request.params[3].get_str();

// Comment
if (!request.params[3].isNull() && !request.params[3].get_str().empty())
wtx.mapValue["comment"] = request.params[3].get_str();

// Comment to
if (!request.params[4].isNull() && !request.params[4].get_str().empty())
wtx.mapValue["to"] = request.params[4].get_str();

bool fSubtractFeeFromAmount = false;
if (!request.params[5].isNull()) {
fSubtractFeeFromAmount = request.params[4].get_bool();
fSubtractFeeFromAmount = request.params[5].get_bool();
}

if (!request.params[6].isNull()) {
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
}

if (!request.params[7].isNull()) {
if (!FeeModeFromString(request.params[8].get_str(), coin_control.m_fee_mode)) {
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
Expand Down Expand Up @@ -1197,11 +1201,11 @@ UniValue sendmany(const JSONRPCRequest& request)
// }

if (!request.params[5].isNull()) {
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
coin_control.m_confirm_target = ParseConfirmTarget(request.params[5]);
}

if (!request.params[6].isNull()) {
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
if (!FeeModeFromString(request.params[6].get_str(), coin_control.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
Expand Down Expand Up @@ -3586,4 +3590,4 @@ void RegisterWalletRPCCommands(CRPCTable &t)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
}

0 comments on commit 159bc4a

Please sign in to comment.