Skip to content

Commit efa19d4

Browse files
committed
feat: wait for miner to be unblocked between blocks
In addition to waiting for the last block it mined to be processed, now the miner will also wait to be unblocked. This ensures that the miner does not start mining before it is unblocked by the chains coordinator thread. This solves flakiness in `tests::signer::v0::verify_mempool_caches`.
1 parent cdf3ce0 commit efa19d4

File tree

1 file changed

+10
-1
lines changed
  • testnet/stacks-node/src/nakamoto_node

1 file changed

+10
-1
lines changed

testnet/stacks-node/src/nakamoto_node/miner.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,16 @@ impl BlockMinerThread {
704704
)?
705705
.ok_or_else(|| NakamotoNodeError::UnexpectedChainState)?;
706706

707-
if processed {
707+
// Once the block has been processed and the miner is no longer
708+
// blocked, we can continue mining.
709+
if processed
710+
&& !(*self
711+
.globals
712+
.get_miner_status()
713+
.lock()
714+
.expect("FATAL: mutex poisoned"))
715+
.is_blocked()
716+
{
708717
break;
709718
}
710719

0 commit comments

Comments
 (0)