mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 00:05:13 +02:00
Return correct error codes in removeprunedfunds().
The removeprunedfunds() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when the transaction was
not found in the wallet). 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.
This error code has been replaced with RPC_WALLET_ERROR.
This commit also updates the test cases to explicitly test the error code.
Github-Pull: #9853
Rebased-From: 960bc7f778
This commit is contained in:
committed by
Luke Dashjr
parent
fe51c8924e
commit
18c109ddb1
@@ -340,11 +340,11 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
|
||||
vector<uint256> vHashOut;
|
||||
|
||||
if(pwalletMain->ZapSelectTx(vHash, vHashOut) != DB_LOAD_OK) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not properly delete the transaction.");
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Could not properly delete the transaction.");
|
||||
}
|
||||
|
||||
if(vHashOut.empty()) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction does not exist in wallet.");
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Transaction does not exist in wallet.");
|
||||
}
|
||||
|
||||
return NullUniValue;
|
||||
|
||||
Reference in New Issue
Block a user