From dab804c18a427901684ebe936b2069a97e04a268 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Thu, 9 Feb 2017 15:48:39 -0500 Subject: Return correct error codes in fundrawtransaction(). The fundrawtransaction() RPC was returning misleading or incorrect error codes (for example RPC_INTERNAL_ERROR when funding the transaction failed). This commit fixes those error codes: - RPC_INTERNAL_ERROR should not be returned for application-level errors, only for genuine internal errors such as corrupted data. That error code has been replaced with RPC_WALLET_ERROR. This commit also updates the test cases to explicitly test the error code. --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ea6795aeaa..90dd3a0b2a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2761,7 +2761,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request) string strFailReason; if (!pwallet->FundTransaction(tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, setSubtractFeeFromOutputs, reserveChangeKey, changeAddress)) { - throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason); + throw JSONRPCError(RPC_WALLET_ERROR, strFailReason); } UniValue result(UniValue::VOBJ); -- cgit v1.2.3