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

This commit is contained in:
Jeff Garzik
2012-05-14 01:11:11 -04:00
committed by Jeff Garzik
parent 09b4e26a44
commit 0fb78eae34
3 changed files with 15 additions and 6 deletions

View File

@@ -1037,7 +1037,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();
@@ -1059,7 +1060,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;
}