@@ -1923,6 +1923,18 @@ fn miner_forking() {
1923
1923
. unwrap ( )
1924
1924
. block_height
1925
1925
} ;
1926
+
1927
+ let wait_for_chains = || {
1928
+ wait_for ( 30 , || {
1929
+ let Some ( chain_info_1) = get_chain_info_opt ( & conf) else {
1930
+ return Ok ( false ) ;
1931
+ } ;
1932
+ let Some ( chain_info_2) = get_chain_info_opt ( & conf_node_2) else {
1933
+ return Ok ( false ) ;
1934
+ } ;
1935
+ Ok ( chain_info_1. burn_block_height == chain_info_2. burn_block_height )
1936
+ } )
1937
+ } ;
1926
1938
info ! ( "------------------------- Reached Epoch 3.0 -------------------------" ) ;
1927
1939
1928
1940
info ! ( "Pausing both miners' block commit submissions" ) ;
@@ -1969,7 +1981,7 @@ fn miner_forking() {
1969
1981
)
1970
1982
. unwrap ( ) ;
1971
1983
1972
- // fetch the current sortition info
1984
+ wait_for_chains ( ) . expect ( "Timed out waiting for Rl1 and Rl2 chains to advance" ) ;
1973
1985
let sortdb = conf. get_burnchain ( ) . open_sortition_db ( true ) . unwrap ( ) ;
1974
1986
let tip = SortitionDB :: get_canonical_burn_chain_tip ( sortdb. conn ( ) ) . unwrap ( ) ;
1975
1987
// make sure the tenure was won by RL1
@@ -2047,6 +2059,7 @@ fn miner_forking() {
2047
2059
. expect ( "RL1 did not produce a tenure extend block" ) ;
2048
2060
2049
2061
// fetch the current sortition info
2062
+ wait_for_chains ( ) . expect ( "Timed out waiting for Rl1 and Rl2 chains to advance" ) ;
2050
2063
let tip = SortitionDB :: get_canonical_burn_chain_tip ( sortdb. conn ( ) ) . unwrap ( ) ;
2051
2064
// make sure the tenure was won by RL2
2052
2065
assert ! ( tip. sortition, "No sortition was won" ) ;
@@ -2145,6 +2158,7 @@ fn miner_forking() {
2145
2158
. unwrap ( ) ;
2146
2159
2147
2160
// fetch the current sortition info
2161
+ wait_for_chains ( ) . expect ( "Timed out waiting for Rl1 and Rl2 chains to advance" ) ;
2148
2162
let tip = SortitionDB :: get_canonical_burn_chain_tip ( sortdb. conn ( ) ) . unwrap ( ) ;
2149
2163
// make sure the tenure was won by RL1
2150
2164
assert ! ( tip. sortition, "No sortition was won" ) ;
0 commit comments