@@ -792,11 +792,22 @@ impl MultipleMinerTest {
792
792
timeout_secs : u64 ,
793
793
) -> Result < String , String > {
794
794
let stacks_height_before = self . get_peer_stacks_tip_height ( ) ;
795
+
795
796
let txid = self . send_contract_publish ( contract_name, contract_src) ;
797
+
798
+ // wait for the new block to be mined
796
799
wait_for ( timeout_secs, || {
797
800
Ok ( self . get_peer_stacks_tip_height ( ) > stacks_height_before)
798
801
} ) ?;
799
- Ok ( txid)
802
+
803
+ // wait for the observer to see it
804
+ self . wait_for_test_observer_blocks ( timeout_secs) ;
805
+
806
+ if last_block_contains_txid ( & txid) {
807
+ Ok ( txid)
808
+ } else {
809
+ Err ( txid)
810
+ }
800
811
}
801
812
802
813
pub fn send_contract_call (
@@ -12592,14 +12603,10 @@ fn miner_rejection_by_contract_call_execution_time_expired() {
12592
12603
// First, lets deploy the contract
12593
12604
let dummy_contract_src = "(define-public (dummy (number uint)) (begin (ok (+ number u1))))" ;
12594
12605
12595
- let contract_publish_txid = miners
12606
+ let _ = miners
12596
12607
. send_and_mine_contract_publish ( "dummy-contract" , dummy_contract_src, 60 )
12597
12608
. expect ( "Failed to publish contract in a new block" ) ;
12598
12609
12599
- miners. wait_for_test_observer_blocks ( 60 ) ;
12600
-
12601
- assert_eq ! ( last_block_contains_txid( & contract_publish_txid) , true ) ;
12602
-
12603
12610
info ! ( "------------------------- Miner 1 Mines a Nakamoto Block N+1 -------------------------" ) ;
12604
12611
12605
12612
let stacks_height_before = miners. get_peer_stacks_tip_height ( ) ;
@@ -12731,16 +12738,12 @@ fn miner_rejection_by_contract_publish_execution_time_expired() {
12731
12738
12732
12739
let tx1 = miners. send_transfer_tx ( ) ;
12733
12740
12734
- let contract_publish_txid = miners
12741
+ let _ = miners
12735
12742
. send_and_mine_contract_publish ( "dummy-contract" , dummy_contract_src, 60 )
12736
- . expect ( "Failed to publish contract in a new block" ) ;
12737
-
12738
- miners. wait_for_test_observer_blocks ( 60 ) ;
12743
+ . expect_err ( "Expected an error while publishing contract in a new block" ) ;
12739
12744
12740
12745
assert_eq ! ( last_block_contains_txid( & tx1) , true ) ;
12741
12746
12742
- assert_eq ! ( last_block_contains_txid( & contract_publish_txid) , false ) ;
12743
-
12744
12747
verify_sortition_winner ( & sortdb, & miner_pkh_1) ;
12745
12748
12746
12749
info ! ( "------------------------- Miner 2 Submits a Block Commit -------------------------" ) ;
@@ -12755,14 +12758,10 @@ fn miner_rejection_by_contract_publish_execution_time_expired() {
12755
12758
12756
12759
miners. sender_nonce -= 1 ;
12757
12760
12758
- let contract_publish_txid = miners
12761
+ let _ = miners
12759
12762
. send_and_mine_contract_publish ( "dummy-contract" , dummy_contract_src, 60 )
12760
12763
. expect ( "Failed to publish contract in a new block" ) ;
12761
12764
12762
- miners. wait_for_test_observer_blocks ( 60 ) ;
12763
-
12764
- assert_eq ! ( last_block_contains_txid( & contract_publish_txid) , true ) ;
12765
-
12766
12765
verify_sortition_winner ( & sortdb, & miner_pkh_2) ;
12767
12766
12768
12767
// ensure both miners are aligned
0 commit comments