diff options
| author | Jeff Garzik <[email protected]> | 2012-05-14 01:11:11 -0400 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2012-05-18 00:03:32 +0000 |
| commit | 738592a002003246849e4b3102aebdab738e976a (patch) | |
| tree | f4923bf5b3417bb88a07d3a55fa5c9f2a1f16087 /src/main.cpp | |
| parent | Hopefully final fix for the stuck blockchain issue (diff) | |
| download | discoin-738592a002003246849e4b3102aebdab738e976a.tar.xz discoin-738592a002003246849e4b3102aebdab738e976a.zip | |
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.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0abba822a..abacbe5e6 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; |