From 8d62e3f80e9bad64bf3716ee511204c575f697fa Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Tue, 19 Sep 2017 13:44:32 +0200 Subject: [PATCH] Throw exception in gobject prepare when CommitTransaction fails --- src/rpc/governance.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 4f00cbae0..952dad487 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -180,7 +180,9 @@ UniValue gobject(const JSONRPCRequest& request) CReserveKey reservekey(pwalletMain); // -- send the tx to the network CValidationState state; - pwalletMain->CommitTransaction(wtx, reservekey, g_connman.get(), state, NetMsgType::TX); + if (!pwalletMain->CommitTransaction(wtx, reservekey, g_connman.get(), state, NetMsgType::TX)) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "CommitTransaction failed! Reason given: " + state.GetRejectReason()); + } DBG( cout << "gobject: prepare " << " strData = " << govobj.GetDataAsString()