diff options
author | Glenn Willen <gwillen@nerdnet.org> | 2019-02-09 20:51:33 -0800 |
---|---|---|
committer | Glenn Willen <gwillen@nerdnet.org> | 2019-02-11 14:08:04 -0800 |
commit | bd0dbe8763fc3029cf96531c9ccaba280b939445 (patch) | |
tree | f9ac966b3363bec18db36714ffc37ec3c36dd4be /src/rpc/util.h | |
parent | c6c3d42a7d6b525144fc7fc6653cd11139d2b34a (diff) |
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.
Diffstat (limited to 'src/rpc/util.h')
-rw-r--r-- | src/rpc/util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/util.h b/src/rpc/util.h index d34c9cfdbb..33fca79029 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_RPC_UTIL_H #define BITCOIN_RPC_UTIL_H +#include <node/transaction.h> #include <pubkey.h> #include <script/standard.h> #include <univalue.h> @@ -31,6 +32,9 @@ UniValue DescribeAddress(const CTxDestination& dest); //! Parse a confirm target option and raise an RPC error if it is invalid. unsigned int ParseConfirmTarget(const UniValue& value); +RPCErrorCode RPCErrorFromTransactionError(TransactionError terr); +UniValue JSONRPCTransactionError(TransactionError terr, const std::string& err_string = ""); + struct RPCArg { enum class Type { OBJ, |