@@ -23,7 +23,7 @@ use std::{env, thread};
23
23
24
24
use clarity:: vm:: types:: PrincipalData ;
25
25
use libsigner:: v0:: messages:: {
26
- BlockRejection , BlockResponse , MessageSlotID , MinerSlotID , RejectCode , SignerMessage ,
26
+ BlockAccepted , BlockRejection , BlockResponse , MessageSlotID , MinerSlotID , RejectCode , SignerMessage
27
27
} ;
28
28
use libsigner:: { BlockProposal , SignerSession , StackerDBSession , VERSION_STRING } ;
29
29
use stacks:: address:: AddressHashMode ;
@@ -8614,8 +8614,6 @@ fn block_proposal_max_age_rejections() {
8614
8614
signer_test. boot_to_epoch_3 ( ) ;
8615
8615
let short_timeout = Duration :: from_secs ( 30 ) ;
8616
8616
8617
- // Make sure no other block approvals are in the system.
8618
- test_observer:: clear ( ) ;
8619
8617
info ! ( "------------------------- Send Block Proposal To Signers -------------------------" ) ;
8620
8618
let info_before = get_chain_info ( & signer_test. running_nodes . conf ) ;
8621
8619
let mut block = NakamotoBlock {
@@ -8628,7 +8626,7 @@ fn block_proposal_max_age_rejections() {
8628
8626
. block_proposal_max_age_secs
8629
8627
. saturating_add ( 1 ) ,
8630
8628
) ;
8631
- let _block_signer_signature_hash_1 = block. header . signer_signature_hash ( ) ;
8629
+ let block_signer_signature_hash_1 = block. header . signer_signature_hash ( ) ;
8632
8630
signer_test. propose_block ( block. clone ( ) , short_timeout) ;
8633
8631
8634
8632
// Next propose a recent invalid block
@@ -8647,31 +8645,27 @@ fn block_proposal_max_age_rejections() {
8647
8645
else {
8648
8646
return None ;
8649
8647
} ;
8650
- assert ! ( matches!(
8651
- message,
8652
- SignerMessage :: BlockResponse ( BlockResponse :: Rejected ( _) )
8653
- ) ) ;
8654
- let SignerMessage :: BlockResponse ( BlockResponse :: Rejected ( BlockRejection {
8655
- reason_code,
8656
- signer_signature_hash,
8657
- signature,
8658
- ..
8659
- } ) ) = message
8660
- else {
8661
- panic ! ( "Received an unexpected block approval from the signer" ) ;
8662
- } ;
8663
- assert_eq ! (
8664
- signer_signature_hash, block_signer_signature_hash_2,
8665
- "Received a rejection for an unexpected block: {signer_signature_hash}"
8666
- ) ;
8667
- assert ! (
8668
- matches!( reason_code, RejectCode :: SortitionViewMismatch ) ,
8669
- "Received a rejection for an unexpected reason: {reason_code}"
8670
- ) ;
8671
- Some ( signature)
8648
+ match message {
8649
+ SignerMessage :: BlockResponse ( BlockResponse :: Rejected ( BlockRejection {
8650
+ signer_signature_hash,
8651
+ signature,
8652
+ ..
8653
+ } ) ) => {
8654
+ assert_eq ! ( signer_signature_hash, block_signer_signature_hash_2, "We should only reject the second block" ) ;
8655
+ Some ( signature)
8656
+ }
8657
+ SignerMessage :: BlockResponse ( BlockResponse :: Accepted ( BlockAccepted {
8658
+ signer_signature_hash,
8659
+ ..
8660
+ } ) ) => {
8661
+ assert_ne ! ( signer_signature_hash, block_signer_signature_hash_1, "We should never have accepted block" ) ;
8662
+ None
8663
+ }
8664
+ _ => None ,
8665
+ }
8672
8666
} )
8673
8667
. collect ( ) ;
8674
- Ok ( rejections. len ( ) == num_signers)
8668
+ Ok ( rejections. len ( ) > num_signers * 7 / 10 )
8675
8669
} )
8676
8670
. expect ( "Timed out waiting for block rejections" ) ;
8677
8671
0 commit comments