From 09f35464dfa5e03dfc3c0aca0515149c82b2608d Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Tue, 22 Oct 2024 10:49:19 -0700 Subject: [PATCH] feat: ensure new miner doesn't propose a block yet --- testnet/stacks-node/src/tests/signer/v0.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testnet/stacks-node/src/tests/signer/v0.rs b/testnet/stacks-node/src/tests/signer/v0.rs index 9f1e10dc69..92463e36e3 100644 --- a/testnet/stacks-node/src/tests/signer/v0.rs +++ b/testnet/stacks-node/src/tests/signer/v0.rs @@ -683,6 +683,11 @@ fn miner_wait_for_proposal() { }) .expect("Timed out waiting for block proposal"); + let proposals_before = signer_test + .running_nodes + .nakamoto_blocks_proposed + .load(Ordering::SeqCst); + let mut block_proposal: Option = None; wait_for(30, || { @@ -737,6 +742,16 @@ fn miner_wait_for_proposal() { TEST_IGNORE_ALL_BLOCK_PROPOSALS.lock().unwrap().take(); + // Ensure that the new miner hasn't proposed any blocks yet + wait_for(10, || { + Ok(signer_test + .running_nodes + .nakamoto_blocks_proposed + .load(Ordering::SeqCst) + > proposals_before) + }) + .expect_err("New miner proposed a block before we expected"); + // Now, generate a block response for each signer signer_test.spawned_signers.iter().for_each(|signer| { let sk = signer.config.stacks_private_key;