@@ -693,7 +693,7 @@ where
693
693
error ! ( "Timed out waiting for check to process" ) ;
694
694
return Err ( "Timed out" . into ( ) ) ;
695
695
}
696
- thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
696
+ thread:: sleep ( Duration :: from_millis ( 500 ) ) ;
697
697
}
698
698
Ok ( ( ) )
699
699
}
@@ -10764,8 +10764,6 @@ fn test_tenure_extend_from_flashblocks() {
10764
10764
let http_origin = format ! ( "http://{}" , & naka_conf. node. rpc_bind) ;
10765
10765
let btc_regtest_controller = & mut signer_test. running_nodes . btc_regtest_controller ;
10766
10766
let coord_channel = signer_test. running_nodes . coord_channel . clone ( ) ;
10767
- let commits_submitted = signer_test. running_nodes . commits_submitted . clone ( ) ;
10768
- let sortitions_processed = signer_test. running_nodes . sortitions_processed . clone ( ) ;
10769
10767
let counters = signer_test. running_nodes . counters . clone ( ) ;
10770
10768
let nakamoto_test_skip_commit_op = signer_test
10771
10769
. running_nodes
@@ -10818,57 +10816,33 @@ fn test_tenure_extend_from_flashblocks() {
10818
10816
) ;
10819
10817
submit_tx ( & http_origin, & contract_tx) ;
10820
10818
10821
- let blocks_processed_before = coord_channel
10822
- . lock ( )
10823
- . expect ( "Mutex poisoned" )
10824
- . get_stacks_blocks_processed ( ) ;
10825
-
10826
10819
wait_for ( 120 , || {
10827
- let blocks_processed = coord_channel
10828
- . lock ( )
10829
- . expect ( "Mutex poisoned" )
10830
- . get_stacks_blocks_processed ( ) ;
10831
- Ok ( blocks_processed > blocks_processed_before)
10820
+ let sender_nonce = get_account ( & naka_conf. node . data_url , & deployer_addr) . nonce ;
10821
+ Ok ( sender_nonce > 0 )
10832
10822
} )
10833
10823
. expect ( "Timed out waiting for interim blocks to be mined" ) ;
10834
10824
10835
10825
next_block_and_mine_commit ( btc_regtest_controller, 60 , & naka_conf, & counters) . unwrap ( ) ;
10836
10826
10837
10827
// stall miner and relayer
10838
10828
10839
- // make tenure but don't wait for a stacks block
10840
- next_block_and_commits_only ( btc_regtest_controller, 60 , & naka_conf, & counters) . unwrap ( ) ;
10829
+ // make tenure
10830
+ next_block_and_mine_commit ( btc_regtest_controller, 60 , & naka_conf, & counters) . unwrap ( ) ;
10841
10831
10842
- // prevent the mienr from sending another block-commit
10832
+ // prevent the miner from sending another block-commit
10843
10833
nakamoto_test_skip_commit_op. set ( true ) ;
10844
10834
10845
- // make sure we get a block-found tenure change
10846
- let blocks_processed_before = coord_channel
10847
- . lock ( )
10848
- . expect ( "Mutex poisoned" )
10849
- . get_stacks_blocks_processed ( ) ;
10850
-
10851
- // make sure the relayer processes both sortitions
10852
- let sortitions_processed_before = sortitions_processed. load ( Ordering :: SeqCst ) ;
10835
+ let info_before = get_chain_info ( & naka_conf) ;
10853
10836
10854
10837
// mine another Bitcoin block right away, since it will contain a block-commit
10855
10838
btc_regtest_controller. bootstrap_chain ( 1 ) ;
10856
10839
10857
- wait_for ( 60 , || {
10858
- sleep_ms ( 100 ) ;
10859
- let sortitions_cnt = sortitions_processed. load ( Ordering :: SeqCst ) ;
10860
- Ok ( sortitions_cnt > sortitions_processed_before)
10861
- } )
10862
- . unwrap ( ) ;
10863
-
10864
10840
wait_for ( 120 , || {
10865
- let blocks_processed = coord_channel
10866
- . lock ( )
10867
- . expect ( "Mutex poisoned" )
10868
- . get_stacks_blocks_processed ( ) ;
10869
- Ok ( blocks_processed > blocks_processed_before)
10841
+ let info = get_chain_info ( & naka_conf) ;
10842
+ Ok ( info. burn_block_height > info_before. burn_block_height
10843
+ && info. stacks_tip_height > info_before. stacks_tip_height )
10870
10844
} )
10871
- . expect ( "Timed out waiting for interim blocks to be mined" ) ;
10845
+ . unwrap ( ) ;
10872
10846
10873
10847
let ( canonical_stacks_tip_ch, _) =
10874
10848
SortitionDB :: get_canonical_stacks_chain_tip_hash ( sortdb. conn ( ) ) . unwrap ( ) ;
@@ -10895,11 +10869,9 @@ fn test_tenure_extend_from_flashblocks() {
10895
10869
// Given the above, this will be an `Extend` tenure.
10896
10870
TEST_MINER_THREAD_STALL . set ( false ) ;
10897
10871
10898
- let sortitions_processed_before = sortitions_processed. load ( Ordering :: SeqCst ) ;
10899
10872
wait_for ( 60 , || {
10900
- sleep_ms ( 100 ) ;
10901
- let sortitions_cnt = sortitions_processed. load ( Ordering :: SeqCst ) ;
10902
- Ok ( sortitions_cnt > sortitions_processed_before)
10873
+ let cur_sort_tip = SortitionDB :: get_canonical_burn_chain_tip ( sortdb. conn ( ) ) . unwrap ( ) ;
10874
+ Ok ( cur_sort_tip. block_height > sort_tip. block_height )
10903
10875
} )
10904
10876
. unwrap ( ) ;
10905
10877
@@ -10977,15 +10949,14 @@ fn test_tenure_extend_from_flashblocks() {
10977
10949
10978
10950
// wait for the miner directive to be processed
10979
10951
wait_for ( 60 , || {
10980
- sleep_ms ( 30_000 ) ;
10981
10952
let directives_cnt = nakamoto_miner_directives. load ( Ordering :: SeqCst ) ;
10982
10953
Ok ( directives_cnt > miner_directives_before)
10983
10954
} )
10984
10955
. unwrap ( ) ;
10985
10956
10986
10957
// wait for all of the aforementioned transactions to get mined
10987
10958
wait_for ( 120 , || {
10988
- // fill mempool with transactions that depend on the burn view
10959
+ // check account nonces from the sent transactions
10989
10960
for ( sender_sk, account_before) in account_keys. iter ( ) . zip ( accounts_before. iter ( ) ) {
10990
10961
let sender_addr = tests:: to_addr ( sender_sk) ;
10991
10962
let account = loop {
@@ -11042,28 +11013,7 @@ fn test_tenure_extend_from_flashblocks() {
11042
11013
}
11043
11014
11044
11015
// mine one additional tenure, to verify that we're on track
11045
- let commits_before = commits_submitted. load ( Ordering :: SeqCst ) ;
11046
- let node_info_before = get_chain_info_opt ( & naka_conf) . unwrap ( ) ;
11047
-
11048
- btc_regtest_controller. bootstrap_chain ( 1 ) ;
11049
-
11050
- wait_for ( 20 , || {
11051
- Ok ( commits_submitted. load ( Ordering :: SeqCst ) > commits_before)
11052
- } )
11053
- . unwrap ( ) ;
11054
-
11055
- // there was a sortition winner
11056
- let sort_tip = SortitionDB :: get_canonical_burn_chain_tip ( sortdb. conn ( ) ) . unwrap ( ) ;
11057
- assert ! ( sort_tip. sortition) ;
11058
-
11059
- wait_for ( 20 , || {
11060
- let node_info = get_chain_info_opt ( & naka_conf) . unwrap ( ) ;
11061
- Ok (
11062
- node_info. burn_block_height > node_info_before. burn_block_height
11063
- && node_info. stacks_tip_height > node_info_before. stacks_tip_height ,
11064
- )
11065
- } )
11066
- . unwrap ( ) ;
11016
+ next_block_and_mine_commit ( btc_regtest_controller, 60 , & naka_conf, & counters) . unwrap ( ) ;
11067
11017
11068
11018
// boot a follower. it should reach the chain tip
11069
11019
info ! ( "----- BEGIN FOLLOWR BOOTUP ------" ) ;
@@ -11118,9 +11068,8 @@ fn test_tenure_extend_from_flashblocks() {
11118
11068
11119
11069
debug ! ( "Booted follower-thread" ) ;
11120
11070
11121
- let miner_info = get_chain_info_result ( & naka_conf) . unwrap ( ) ;
11122
-
11123
11071
wait_for ( 300 , || {
11072
+ let miner_info = get_chain_info_result ( & naka_conf) . unwrap ( ) ;
11124
11073
let Ok ( info) = get_chain_info_result ( & follower_conf) else {
11125
11074
sleep_ms ( 1000 ) ;
11126
11075
return Ok ( false ) ;
0 commit comments