Skip to content

Commit

Permalink
test: fix flakiness in global_acceptance_depends_on_block_announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
kantai committed Jan 22, 2025
1 parent e0d3f3c commit bbeb7d6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions testnet/stacks-node/src/tests/signer/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}
});
}
Expand Down

0 comments on commit bbeb7d6

Please sign in to comment.