mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
fix: make sure we flush our committed best block in no-upgrade cases
This was spotted when working on `feature_txindex_compatibility.py`, attempting to load old databases would fail because `MigrateDBIfNeeded()` would delete `DB_OLD_BEST_BLOCK`, write `EVODB_BEST_BLOCK`, commit it but never flush it. So when `MigrateDBIfNeeded2()` would read it again, it would note the lack of `DB_OLD_BEST_BLOCK` and conclude it was a failed run and exit. This is solved by actually flushing our new best block, which would prevent `MigrateDBIfNeeded2` from raising an objection.
This commit is contained in:
parent
3f0c2ff324
commit
ebae59eedf
@ -1238,6 +1238,10 @@ bool CDeterministicMNManager::MigrateDBIfNeeded()
|
||||
auto dbTx = m_evoDb.BeginTransaction();
|
||||
m_evoDb.WriteBestBlock(m_chainstate.m_chain.Tip()->GetBlockHash());
|
||||
dbTx->Commit();
|
||||
if (!m_evoDb.CommitRootTransaction()) {
|
||||
LogPrintf("CDeterministicMNManager::%s -- failed to commit to evoDB\n", __func__);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1349,6 +1353,10 @@ bool CDeterministicMNManager::MigrateDBIfNeeded2()
|
||||
auto dbTx = m_evoDb.BeginTransaction();
|
||||
m_evoDb.WriteBestBlock(m_chainstate.m_chain.Tip()->GetBlockHash());
|
||||
dbTx->Commit();
|
||||
if (!m_evoDb.CommitRootTransaction()) {
|
||||
LogPrintf("CDeterministicMNManager::%s -- failed to commit to evoDB\n", __func__);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user