mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
partial bitcoin#24117: make indices robust against init aborts
excludes: - bfcd60f5d505334230013de4115483b22a7898ee
This commit is contained in:
parent
4e9d9a69e8
commit
123cf8d2c7
@ -203,6 +203,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;
|
||||
}
|
||||
|
@ -355,7 +355,8 @@ bool CoinStatsIndex::Init()
|
||||
if (pindex) {
|
||||
DBVal entry;
|
||||
if (!LookUpOne(*m_db, pindex, entry)) {
|
||||
return false;
|
||||
return error("%s: Cannot read current %s state; index may be corrupted",
|
||||
__func__, GetName());
|
||||
}
|
||||
|
||||
m_transaction_output_count = entry.transaction_output_count;
|
||||
|
Loading…
Reference in New Issue
Block a user