Skip to content

Commit eea7554

Browse files
fix: update index matching in rpcwallet~
* Fix indicies to match correct counterparts * Fix inidices to correct index where index specified does not exist
1 parent c8197cd commit eea7554

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,11 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
534534
// }
535535

536536
if (!request.params[5].isNull()) {
537-
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
537+
coin_control.m_confirm_target = ParseConfirmTarget(request.params[5]);
538538
}
539539

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

640640
// Wallet comments
641641
CWalletTx wtx;
642-
if (!request.params[3].isNull() && !request.params[2].get_str().empty())
643-
wtx.mapValue["comment"] = request.params[2].get_str();
644-
if (!request.params[4].isNull() && !request.params[3].get_str().empty())
645-
wtx.mapValue["to"] = request.params[3].get_str();
646642

643+
// Comment
644+
if (!request.params[3].isNull() && !request.params[3].get_str().empty())
645+
wtx.mapValue["comment"] = request.params[3].get_str();
646+
647+
// Comment to
648+
if (!request.params[4].isNull() && !request.params[4].get_str().empty())
649+
wtx.mapValue["to"] = request.params[4].get_str();
650+
647651
bool fSubtractFeeFromAmount = false;
648652
if (!request.params[5].isNull()) {
649-
fSubtractFeeFromAmount = request.params[4].get_bool();
653+
fSubtractFeeFromAmount = request.params[5].get_bool();
650654
}
651655

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

656660
if (!request.params[7].isNull()) {
657-
if (!FeeModeFromString(request.params[8].get_str(), coin_control.m_fee_mode)) {
661+
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
658662
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
659663
}
660664
}
@@ -1197,11 +1201,11 @@ UniValue sendmany(const JSONRPCRequest& request)
11971201
// }
11981202

11991203
if (!request.params[5].isNull()) {
1200-
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
1204+
coin_control.m_confirm_target = ParseConfirmTarget(request.params[5]);
12011205
}
12021206

12031207
if (!request.params[6].isNull()) {
1204-
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
1208+
if (!FeeModeFromString(request.params[6].get_str(), coin_control.m_fee_mode)) {
12051209
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
12061210
}
12071211
}
@@ -3586,4 +3590,4 @@ void RegisterWalletRPCCommands(CRPCTable &t)
35863590
{
35873591
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
35883592
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
3589-
}
3593+
}

0 commit comments

Comments
 (0)