Skip to content

Commit

Permalink
Plugin ocean_invalidate_block
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Oct 4, 2024
1 parent bf4b89f commit b8ad8c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <dfi/validation.h>
#include <dfi/vaulthistory.h>
#include <ffi/ffihelpers.h>
#include <ffi/ffiexports.h>
#include <flatfile.h>
#include <hash.h>
#include <index/txindex.h>
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit b8ad8c3

Please sign in to comment.