From aba47e422895320180e32b1b1a6d194d85652f3f Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Fri, 21 Oct 2022 16:21:56 -0400 Subject: [PATCH] fix: only disable the miner thread if the relayer reports that a network result contained new data --- testnet/stacks-node/src/neon_node.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/testnet/stacks-node/src/neon_node.rs b/testnet/stacks-node/src/neon_node.rs index 69bd7c1f57..fcef28f8ad 100644 --- a/testnet/stacks-node/src/neon_node.rs +++ b/testnet/stacks-node/src/neon_node.rs @@ -2005,14 +2005,6 @@ impl RelayerThread { net_result.burn_height ); - // if there are any blocks or microblocks, then stop mining so we can process - // them. - if net_result.has_blocks() || net_result.has_microblocks() { - // temporarily halt mining - debug!("Relayer: block mining to process newly-arrived blocks or microblocks"); - signal_mining_blocked(self.globals.get_miner_status()); - } - if self.last_network_block_height != net_result.burn_height { // burnchain advanced; disable mining until we also do a download pass. self.last_network_block_height = net_result.burn_height; @@ -2042,6 +2034,13 @@ impl RelayerThread { .expect("BUG: failure processing network results") }); + if net_receipts.num_new_blocks > 0 || net_receipts.num_new_confirmed_microblocks > 0 { + // if we received any new block data that could invalidate our view of the chain tip, + // then stop mining until we process it + debug!("Relayer: block mining to process newly-arrived blocks or microblocks"); + signal_mining_blocked(self.globals.get_miner_status()); + } + let mempool_txs_added = net_receipts.mempool_txs_added.len(); if mempool_txs_added > 0 { self.event_dispatcher