Always check return values of TxnBegin() and TxnCommit()

This commit is contained in:
Jeff Garzik
2012-05-18 00:04:18 +00:00
committed by Luke Dashjr
parent 0d174e130b
commit 3a05f1d2ce
3 changed files with 15 additions and 6 deletions
+4 -2
View File
@@ -840,7 +840,8 @@ Value movecmd(const Array& params, bool fHelp)
strComment = params[4].get_str();
CWalletDB walletdb(pwalletMain->strWalletFile);
walletdb.TxnBegin();
if (!walletdb.TxnBegin())
throw JSONRPCError(-20, "database error");
int64 nNow = GetAdjustedTime();
@@ -862,7 +863,8 @@ Value movecmd(const Array& params, bool fHelp)
credit.strComment = strComment;
walletdb.WriteAccountingEntry(credit);
walletdb.TxnCommit();
if (!walletdb.TxnCommit())
throw JSONRPCError(-20, "database error");
return true;
}