Skip to content

Commit

Permalink
fix: only disable the miner thread if the relayer reports that a netw…
Browse files Browse the repository at this point in the history
…ork result contained new data
  • Loading branch information
jcnelson committed Oct 21, 2022
1 parent b1b0e2c commit aba47e4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions testnet/stacks-node/src/neon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aba47e4

Please sign in to comment.