Skip to content

Commit 4be639e

Browse files
committed
Use RPC_INVALID_PARAMETER instead of RPC_WALLET_ERROR for invalid amount.
No return at the end of void function.
1 parent b93173d commit 4be639e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/rpcwallet.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ void SendMoney(const CTxDestination &address, CAmount nValue, CWalletTx& wtxNew)
314314
{
315315
// Check amount
316316
if (nValue <= 0)
317-
throw JSONRPCError(RPC_WALLET_ERROR, "Invalid amount");
317+
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
318318

319319
if (nValue > pwalletMain->GetBalance())
320320
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
@@ -342,8 +342,6 @@ void SendMoney(const CTxDestination &address, CAmount nValue, CWalletTx& wtxNew)
342342
}
343343
if (!pwalletMain->CommitTransaction(wtxNew, reservekey))
344344
throw JSONRPCError(RPC_WALLET_ERROR, "Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
345-
346-
return;
347345
}
348346

349347
Value sendtoaddress(const Array& params, bool fHelp)

0 commit comments

Comments
 (0)