diff --git a/src/init.cpp b/src/init.cpp index d9c605d1f4..2b72bf16a3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -2513,7 +2513,7 @@ bool AppInitMain(InitInterfaces& interfaces) // ********************************************************* Step 15: start genesis ocean indexing - if(gArgs.GetBoolArg("-oceanarchive", DEFAULT_OCEAN_INDEXER_ENABLED)) { + if (gArgs.GetBoolArg("-oceanarchive", DEFAULT_OCEAN_INDEXER_ENABLED)) { const CBlock &block = chainparams.GenesisBlock(); const CBlockIndex* pblockindex; diff --git a/src/validation.cpp b/src/validation.cpp index 64e315db5c..82266c7eb3 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -3765,6 +3766,13 @@ bool CChainState::DisconnectTip(CValidationState &state, XResultThrowOnErr(evm_try_disconnect_latest_block(result)); } + if (gArgs.GetBoolArg("-oceanarchive", DEFAULT_OCEAN_INDEXER_ENABLED)) { + const UniValue b = blockToJSON(mnview, block, pindexDelete, pindexDelete, true, 2); + XResultThrowOnErr(ocean_invalidate_block(result, b.write())); + } + + + bool flushed = view.Flush() && mnview.Flush(); assert(flushed); mnview.GetHistoryWriters().FlushDB();