From bbeb7d62e3cb49bcd64ca9e0c58a1a0fdb10ad50 Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Wed, 22 Jan 2025 12:22:55 -0600 Subject: [PATCH] test: fix flakiness in global_acceptance_depends_on_block_announcement --- testnet/stacks-node/src/tests/signer/v0.rs | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/testnet/stacks-node/src/tests/signer/v0.rs b/testnet/stacks-node/src/tests/signer/v0.rs index 8d7953aa72..7aeb845f47 100644 --- a/testnet/stacks-node/src/tests/signer/v0.rs +++ b/testnet/stacks-node/src/tests/signer/v0.rs @@ -9832,14 +9832,19 @@ fn global_acceptance_depends_on_block_announcement() { .stacks_client .get_peer_info() .expect("Failed to get peer info"); - Ok(info.stacks_tip_height > info_before.stacks_tip_height) + Ok(info.stacks_tip_height > info_before.stacks_tip_height + && info_before.stacks_tip_consensus_hash != info.stacks_tip_consensus_hash) }, ) - .unwrap(); + .expect("Stacks miner failed to produce new blocks during the newest burn block's tenure"); let info_after = signer_test .stacks_client .get_peer_info() .expect("Failed to get peer info"); + let info_after_stacks_block_id = StacksBlockId::new( + &info_after.stacks_tip_consensus_hash, + &info_after.stacks_tip, + ); let mut sister_block = None; let start_time = Instant::now(); while sister_block.is_none() && start_time.elapsed() < Duration::from_secs(45) { @@ -9849,17 +9854,14 @@ fn global_acceptance_depends_on_block_announcement() { .find_map(|chunk| { let message = SignerMessage::consensus_deserialize(&mut chunk.data.as_slice()) .expect("Failed to deserialize SignerMessage"); - match message { - SignerMessage::BlockProposal(proposal) => { - if proposal.block.header.consensus_hash - == info_after.stacks_tip_consensus_hash - { - Some(proposal.block) - } else { - None - } + if let SignerMessage::BlockProposal(proposal) = message { + if proposal.block.block_id() == info_after_stacks_block_id { + Some(proposal.block) + } else { + None } - _ => None, + } else { + None } }); }