aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@exmulti.com>2012-05-14 01:11:11 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2012-05-18 00:03:32 +0000
commit738592a002003246849e4b3102aebdab738e976a (patch)
treef4923bf5b3417bb88a07d3a55fa5c9f2a1f16087 /src/main.cpp
parentc455aec6997ad9164f1083e93bb51095a25180cd (diff)
downloadbitcoin-738592a002003246849e4b3102aebdab738e976a.tar.xz
Always check return values of TxnBegin() and TxnCommit()
PARTIAL, since d68dcf7 isn't backported (yet)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 5 insertions, 2 deletions
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;