diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 36fa33ddde..1f2e281acd 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -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"); } } @@ -639,14 +639,18 @@ 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()) { @@ -654,7 +658,7 @@ UniValue sendfromaddress(const JSONRPCRequest& request) } 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"); } } @@ -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"); } } @@ -3586,4 +3590,4 @@ void RegisterWalletRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); -} +} \ No newline at end of file