mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-11 09:42:17 +01:00
Always check return values of TxnBegin() and TxnCommit()
PARTIAL, since d68dcf7 isn't backported (yet)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user