Skip to content

Commit 63fa7fa

Browse files
committed
Fix locally_rejected_blocks_overriden_by_global_acceptance
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 72a56cf commit 63fa7fa

File tree

1 file changed

+24
-9
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+24
-9
lines changed

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,21 +4164,36 @@ fn locally_rejected_blocks_overriden_by_global_acceptance() {
41644164
info_before.stacks_tip_height + 1,
41654165
info_after.stacks_tip_height
41664166
);
4167-
let nmb_signatures = signer_test
4168-
.stacks_client
4169-
.get_tenure_tip(&info_after.stacks_tip_consensus_hash)
4170-
.expect("Failed to get tip")
4171-
.as_stacks_nakamoto()
4172-
.expect("Not a Nakamoto block")
4173-
.signer_signature
4174-
.len();
4175-
assert_eq!(nmb_signatures, num_signers);
41764167

41774168
// Ensure that the block was accepted globally so the stacks tip has advanced to N
41784169
let nakamoto_blocks = test_observer::get_mined_nakamoto_blocks();
41794170
let block_n = nakamoto_blocks.last().unwrap();
41804171
assert_eq!(info_after.stacks_tip.to_string(), block_n.block_hash);
41814172

4173+
// Make sure that ALL signers accepted the block proposal
4174+
wait_for(short_timeout, || {
4175+
let signatures = test_observer::get_stackerdb_chunks()
4176+
.into_iter()
4177+
.flat_map(|chunk| chunk.modified_slots)
4178+
.filter_map(|chunk| {
4179+
let message = SignerMessage::consensus_deserialize(&mut chunk.data.as_slice())
4180+
.expect("Failed to deserialize SignerMessage");
4181+
match message {
4182+
SignerMessage::BlockResponse(BlockResponse::Accepted((hash, signature))) => {
4183+
if hash == block_n.signer_signature_hash {
4184+
Some(signature)
4185+
} else {
4186+
None
4187+
}
4188+
}
4189+
_ => None,
4190+
}
4191+
})
4192+
.collect::<Vec<_>>();
4193+
Ok(signatures.len() == num_signers)
4194+
})
4195+
.expect("FAIL: Timed out waiting for block proposal acceptance by ALL signers");
4196+
41824197
info!("------------------------- Mine Nakamoto Block N+1 -------------------------");
41834198
// Make less than 30% of the signers reject the block and ensure it is STILL marked globally accepted
41844199
let rejecting_signers: Vec<_> = signer_test

0 commit comments

Comments
 (0)