mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Switch away from exceptions in refactored tx code
After refactoring general-purpose PSBT and transaction code out of RPC code, for use in the GUI, it's no longer appropriate to throw exceptions. Instead we now return bools for success, and take an output parameter for an error object. We still use JSONRPCError() for the error objects, since only RPC callers actually care about the error codes.
This commit is contained in:
@@ -1050,7 +1050,14 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
|
||||
bool allowhighfees = false;
|
||||
if (!request.params[1].isNull()) allowhighfees = request.params[1].get_bool();
|
||||
return BroadcastTransaction(tx, allowhighfees).GetHex();
|
||||
uint256 txid;
|
||||
TransactionError err;
|
||||
std::string err_string;
|
||||
if (!BroadcastTransaction(tx, txid, err, err_string, allowhighfees)) {
|
||||
throw JSONRPCTransactionError(err, err_string);
|
||||
}
|
||||
|
||||
return txid.GetHex();
|
||||
}
|
||||
|
||||
static UniValue testmempoolaccept(const JSONRPCRequest& request)
|
||||
|
||||
Reference in New Issue
Block a user