mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 00:34:01 +02:00
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.
Github-Pull: #9853
Rebased-From: dab804c18a
This commit is contained in:
committed by
Luke Dashjr
parent
4943d7a9fe
commit
f5efe82a83
@@ -2657,7 +2657,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
|
||||
string strFailReason;
|
||||
|
||||
if(!pwalletMain->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);
|
||||
result.push_back(Pair("hex", EncodeHexTx(tx)));
|
||||
|
||||
Reference in New Issue
Block a user