Skip to content

Commit

Permalink
fix: update sendfromaddress index matching
Browse files Browse the repository at this point in the history
* Fix index 3 (comment) check to check and set own index value
* Fix index 4 (comment_to) check to check and set own index value
* Fix index 5 (subtractfeefromamount) to check and set own index value
* Fix index 7 to not check nonexisting index 8 value and use own index
  • Loading branch information
michaelmcshinsky committed Dec 16, 2022
1 parent c8197cd commit 5ab4628
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
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

0 comments on commit 5ab4628

Please sign in to comment.