From 738592a002003246849e4b3102aebdab738e976a Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 14 May 2012 01:11:11 -0400 Subject: Always check return values of TxnBegin() and TxnCommit() PARTIAL, since d68dcf7 isn't backported (yet) --- src/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 0abba822a8..abacbe5e63 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1336,7 +1336,9 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew) { uint256 hash = GetHash(); - txdb.TxnBegin(); + if (!txdb.TxnBegin()) + return error("SetBestChain() : TxnBegin failed"); + if (pindexGenesisBlock == NULL && hash == hashGenesisBlock) { txdb.WriteHashBestChain(hash); @@ -1416,7 +1418,8 @@ bool CBlock::AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos) pindexNew->bnChainWork = (pindexNew->pprev ? pindexNew->pprev->bnChainWork : 0) + pindexNew->GetBlockWork(); CTxDB txdb; - txdb.TxnBegin(); + if (!txdb.TxnBegin()) + return false; txdb.WriteBlockIndex(CDiskBlockIndex(pindexNew)); if (!txdb.TxnCommit()) return false; -- cgit v1.2.3