fix: force ehf signal db update

This commit is contained in:
UdjinM6 2024-11-28 13:22:47 +03:00 committed by Konstantin Akimov
parent 94d80323d4
commit 05041a4572
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
3 changed files with 25 additions and 0 deletions

View File

@ -375,6 +375,25 @@ void CMNHFManager::ConnectManagers(gsl::not_null<ChainstateManager*> chainman, g
m_qman = qman;
}
bool CMNHFManager::ForceSignalDBUpdate()
{
// force ehf signals db update
auto dbTx = m_evoDb.BeginTransaction();
const bool last_legacy = bls::bls_legacy_scheme.load();
bls::bls_legacy_scheme.store(false);
GetSignalsStage(m_chainman->ActiveChainstate().m_chain.Tip());
bls::bls_legacy_scheme.store(last_legacy);
dbTx->Commit();
// flush it to disk
if (!m_evoDb.CommitRootTransaction()) {
LogPrintf("CMNHFManager::%s -- failed to commit to evoDB\n", __func__);
return false;
}
return true;
}
std::string MNHFTx::ToString() const
{
return strprintf("MNHFTx(versionBit=%d, quorumHash=%s, sig=%s)",

View File

@ -155,6 +155,8 @@ public:
*/
void DisconnectManagers() { m_chainman = nullptr; m_qman = nullptr; };
bool ForceSignalDBUpdate();
private:
void AddToCache(const Signals& signals, const CBlockIndex* const pindex);

View File

@ -2058,6 +2058,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
strLoadError = _("Error upgrading evo database");
break;
}
if (!node.mnhf_manager->ForceSignalDBUpdate()) {
strLoadError = _("Error upgrading evo database for EHF");
break;
}
for (CChainState* chainstate : chainman.GetAll()) {
if (!is_coinsview_empty(chainstate)) {