Throw exception in gobject prepare when CommitTransaction fails

This commit is contained in:
Alexander Block 2017-09-19 13:44:32 +02:00
parent 848f3389b4
commit 8d62e3f80e

View File

@ -180,7 +180,9 @@ UniValue gobject(const JSONRPCRequest& request)
CReserveKey reservekey(pwalletMain); CReserveKey reservekey(pwalletMain);
// -- send the tx to the network // -- send the tx to the network
CValidationState state; 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 " DBG( cout << "gobject: prepare "
<< " strData = " << govobj.GetDataAsString() << " strData = " << govobj.GetDataAsString()