diff --git a/lib/ain-ocean/src/indexer/mod.rs b/lib/ain-ocean/src/indexer/mod.rs index b442a6985d..b991f22c5e 100644 --- a/lib/ain-ocean/src/indexer/mod.rs +++ b/lib/ain-ocean/src/indexer/mod.rs @@ -707,10 +707,6 @@ pub fn invalidate_block(services: &Arc, block: Block) -> median_time: block.mediantime, }; - // invalidate_block - services.block.by_height.delete(&block.height)?; - services.block.by_id.delete(&block.hash)?; - invalidate_block_end(services, &block_ctx)?; // invalidate_dftx @@ -725,6 +721,10 @@ pub fn invalidate_block(services: &Arc, block: Block) -> tx_idx, }; + invalidate_script(services, &ctx, &block.tx)?; + + invalidate_transaction(services, &ctx)?; + let bytes = &ctx.tx.vout[0].script_pub_key.hex; if bytes.len() <= 6 || bytes[0] != 0x6a || bytes[1] > 0x4e { continue; @@ -760,12 +760,13 @@ pub fn invalidate_block(services: &Arc, block: Block) -> log_elapsed(start, "Invalidate dftx"); } } - - invalidate_transaction(services, &ctx)?; - - invalidate_script(services, &ctx, &block.tx)?; } invalidate_block_start(services, &block)?; + + // invalidate_block + services.block.by_height.delete(&block.height)?; + services.block.by_id.delete(&block.hash)?; + Ok(()) }