mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 18:05:58 +02:00
index: Don't commit without valid m_best_block_index
Also report an error when coinstatsindex init fails.
This commit is contained in:
@@ -211,6 +211,11 @@ bool BaseIndex::Commit()
|
||||
bool BaseIndex::CommitInternal(CDBBatch& batch)
|
||||
{
|
||||
LOCK(cs_main);
|
||||
// Don't commit anything if we haven't indexed any block yet
|
||||
// (this could happen if init is interrupted).
|
||||
if (m_best_block_index == nullptr) {
|
||||
return false;
|
||||
}
|
||||
GetDB().WriteBestBlock(batch, m_chainstate->m_chain.GetLocator(m_best_block_index));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user