Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update sendfromaddress index matching #1223

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]);
}
}