diff --git a/src/dfi/masternodes.cpp b/src/dfi/masternodes.cpp index 7b56eedaecf..94d86e4dbbf 100644 --- a/src/dfi/masternodes.cpp +++ b/src/dfi/masternodes.cpp @@ -815,18 +815,6 @@ void CCustomCSView::SetDbVersion(int version) { Write(DbVersion::prefix(), version); } -bool CCustomCSView::GetEvmDirtyFlag() const { - bool dirtyFlag; - if (Read(EvmDirtyFlag::prefix(), dirtyFlag)) { - return dirtyFlag; - } - return false; -} - -void CCustomCSView::SetEvmDirtyFlag(bool flag) { - Write(EvmDirtyFlag::prefix(), flag); -} - CTeamView::CTeam CCustomCSView::CalcNextTeam(int height, const uint256 &stakeModifier) { if (stakeModifier == uint256()) { return Params().GetGenesisTeam(); diff --git a/src/dfi/masternodes.h b/src/dfi/masternodes.h index c72809d94c7..6d2b5733729 100644 --- a/src/dfi/masternodes.h +++ b/src/dfi/masternodes.h @@ -605,10 +605,8 @@ class CCustomCSView : public CMasternodesView, const DCT_ID &id) const override; void SetDbVersion(int version); - int GetDbVersion() const; - void SetEvmDirtyFlag(bool flag); - bool GetEvmDirtyFlag() const; + int GetDbVersion() const; uint256 MerkleRoot(); @@ -626,10 +624,6 @@ class CCustomCSView : public CMasternodesView, struct DbVersion { static constexpr uint8_t prefix() { return 'D'; } }; - - struct EvmDirtyFlag { - static constexpr uint8_t prefix() { return 'p'; } - }; }; std::map AmISignerNow(int height, const CAnchorData::CTeam &team); diff --git a/src/init.cpp b/src/init.cpp index 32435f1eb00..385f4b5d143 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -94,8 +94,6 @@ static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false; // Dump addresses to banlist.dat every 15 minutes (900s) static constexpr int DUMP_BANS_INTERVAL = 60 * 15; -static bool fEvmDatabaseDirty = false; - std::unique_ptr g_connman; std::unique_ptr peerLogic; std::unique_ptr g_banman; @@ -294,12 +292,7 @@ void Shutdown(InitInterfaces& interfaces) // next startup faster by avoiding rescan. ShutdownDfTxGlobalTaskPool(); - auto res = XResultStatusLogged(ain_rs_stop_core_services(result)); - if (!res) { - fEvmDatabaseDirty = true; - } - pcustomcsview->SetEvmDirtyFlag(fEvmDatabaseDirty); - + XResultStatusLogged(ain_rs_stop_core_services(result)); LogPrint(BCLog::SPV, "Releasing\n"); spv::pspv.reset(); { @@ -1838,7 +1831,7 @@ bool AppInitMain(InitInterfaces& interfaces) fReindex = gArgs.GetBoolArg("-reindex", false); bool fReindexChainState = gArgs.GetBoolArg("-reindex-chainstate", false); while (!fLoaded && !ShutdownRequested()) { - bool fReset = (fReindex || fEvmDatabaseDirty); + bool fReset = fReindex; std::string strLoadError; uiInterface.InitMessage(_("Loading block index...").translated); @@ -1928,13 +1921,6 @@ bool AppInitMain(InitInterfaces& interfaces) // Ensure we are on latest DB version pcustomcsview->SetDbVersion(CCustomCSView::DbVersion); - // Set evm database dirty flag - fEvmDatabaseDirty = pcustomcsview->GetEvmDirtyFlag(); - if (!fReset && fEvmDatabaseDirty) { - LogPrintf("Evm database dirty, re-indexing chain state.\n"); - break; - } - // make account history db paccountHistoryDB.reset(); if (gArgs.GetBoolArg("-acindex", DEFAULT_ACINDEX)) { @@ -2063,23 +2049,18 @@ bool AppInitMain(InitInterfaces& interfaces) } while(false); if (!fLoaded && !ShutdownRequested()) { + // first suggest a reindex if (!fReset) { - if (fEvmDatabaseDirty) { - // Evm database dirty. Abort shutdown and run re-index pipeline. + bool fRet = uiInterface.ThreadSafeQuestion( + strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?").translated, + strLoadError + ".\nPlease restart with -reindex or -reindex-chainstate to recover.", + "", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT); + if (fRet) { + fReindex = true; AbortShutdown(); } else { - // first suggest a reindex - bool fRet = uiInterface.ThreadSafeQuestion( - strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?").translated, - strLoadError + ".\nPlease restart with -reindex or -reindex-chainstate to recover.", - "", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT); - if (fRet) { - fReindex = true; - AbortShutdown(); - } else { - LogPrintf("Aborted block database rebuild. Exiting.\n"); - return false; - } + LogPrintf("Aborted block database rebuild. Exiting.\n"); + return false; } } else { return InitError(strLoadError);