@@ -36,7 +36,7 @@ use stacks::net::api::postblock_proposal::{
36
36
BlockValidateOk , BlockValidateReject , BlockValidateResponse ,
37
37
} ;
38
38
use stacks:: types:: chainstate:: { StacksAddress , StacksPublicKey } ;
39
- use stacks:: types:: { PrivateKey , PublicKey } ;
39
+ use stacks:: types:: PrivateKey ;
40
40
use stacks:: util:: get_epoch_time_secs;
41
41
use stacks:: util:: hash:: MerkleHashFunc ;
42
42
use stacks:: util:: secp256k1:: { MessageSignature , Secp256k1PublicKey } ;
@@ -609,73 +609,6 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
609
609
}
610
610
}
611
611
612
- pub fn wait_for_block_acceptance (
613
- & self ,
614
- timeout_secs : u64 ,
615
- signer_signature_hash : & Sha512Trunc256Sum ,
616
- expected_signers : & [ StacksPublicKey ] ,
617
- ) -> Result < ( ) , String > {
618
- // Make sure that at least 70% of signers accepted the block proposal
619
- wait_for ( timeout_secs, || {
620
- let signatures = test_observer:: get_stackerdb_chunks ( )
621
- . into_iter ( )
622
- . flat_map ( |chunk| chunk. modified_slots )
623
- . filter_map ( |chunk| {
624
- let message = SignerMessage :: consensus_deserialize ( & mut chunk. data . as_slice ( ) )
625
- . expect ( "Failed to deserialize SignerMessage" ) ;
626
- if let SignerMessage :: BlockResponse ( BlockResponse :: Accepted ( accepted) ) = message
627
- {
628
- if accepted. signer_signature_hash == * signer_signature_hash
629
- && expected_signers. iter ( ) . any ( |pk| {
630
- pk. verify (
631
- accepted. signer_signature_hash . bits ( ) ,
632
- & accepted. signature ,
633
- )
634
- . expect ( "Failed to verify signature" )
635
- } )
636
- {
637
- return Some ( accepted. signature ) ;
638
- }
639
- }
640
- None
641
- } )
642
- . collect :: < HashSet < _ > > ( ) ;
643
- Ok ( signatures. len ( ) > expected_signers. len ( ) * 7 / 10 )
644
- } )
645
- }
646
-
647
- pub fn wait_for_block_rejections (
648
- & self ,
649
- timeout_secs : u64 ,
650
- expected_signers : & [ StacksPublicKey ] ,
651
- ) -> Result < ( ) , String > {
652
- wait_for ( timeout_secs, || {
653
- let stackerdb_events = test_observer:: get_stackerdb_chunks ( ) ;
654
- let block_rejections: HashSet < _ > = stackerdb_events
655
- . into_iter ( )
656
- . flat_map ( |chunk| chunk. modified_slots )
657
- . filter_map ( |chunk| {
658
- let message = SignerMessage :: consensus_deserialize ( & mut chunk. data . as_slice ( ) )
659
- . expect ( "Failed to deserialize SignerMessage" ) ;
660
- match message {
661
- SignerMessage :: BlockResponse ( BlockResponse :: Rejected ( rejection) ) => {
662
- let rejected_pubkey = rejection
663
- . recover_public_key ( )
664
- . expect ( "Failed to recover public key from rejection" ) ;
665
- if expected_signers. contains ( & rejected_pubkey) {
666
- Some ( rejected_pubkey)
667
- } else {
668
- None
669
- }
670
- }
671
- _ => None ,
672
- }
673
- } )
674
- . collect :: < HashSet < _ > > ( ) ;
675
- Ok ( block_rejections. len ( ) == expected_signers. len ( ) )
676
- } )
677
- }
678
-
679
612
/// Get the latest block response from the given slot
680
613
pub fn get_latest_block_response ( & self , slot_id : u32 ) -> BlockResponse {
681
614
let mut stackerdb = StackerDB :: new_normal (
0 commit comments