@@ -3874,12 +3874,9 @@ fn partial_tenure_fork() {
3874
3874
3875
3875
let mut miner_1_blocks = 0 ;
3876
3876
let mut miner_2_blocks = 0 ;
3877
- // Make sure that both miner 1 and 2 mine at least 1 block each
3878
- while miner_1_tenures < min_miner_1_tenures
3879
- || miner_2_tenures < min_miner_2_tenures
3880
- || miner_1_blocks == 0
3881
- || miner_2_blocks == 0
3882
- {
3877
+ let mut min_miner_2_blocks = 0 ;
3878
+
3879
+ while miner_1_tenures < min_miner_1_tenures || miner_2_tenures < min_miner_2_tenures {
3883
3880
if btc_blocks_mined >= max_nakamoto_tenures {
3884
3881
panic ! ( "Produced {btc_blocks_mined} sortitions, but didn't cover the test scenarios, aborting" ) ;
3885
3882
}
@@ -3963,6 +3960,7 @@ fn partial_tenure_fork() {
3963
3960
// Ensure that miner 2 runs at least one more tenure
3964
3961
min_miner_2_tenures = miner_2_tenures + 1 ;
3965
3962
fork_initiated = true ;
3963
+ min_miner_2_blocks = miner_2_blocks;
3966
3964
}
3967
3965
if miner == 2 && miner_2_tenures == min_miner_2_tenures {
3968
3966
// This is the forking tenure. Ensure that miner 1 runs one more
@@ -4096,15 +4094,9 @@ fn partial_tenure_fork() {
4096
4094
// The height may be higher than expected due to extra transactions waiting
4097
4095
// to be mined during the forking miner's tenure.
4098
4096
// We cannot guarantee due to TooMuchChaining that the miner will mine inter_blocks_per_tenure
4099
- let min_num_miner_2_blocks = std:: cmp:: min (
4100
- miner_2_blocks,
4101
- min_miner_2_tenures * ( inter_blocks_per_tenure + 1 ) ,
4102
- ) ;
4103
- assert ! (
4104
- miner_2_tenures >= min_miner_2_tenures,
4105
- "Miner 2 failed to win its minimum number of tenures"
4106
- ) ;
4107
- assert ! ( peer_1_height >= pre_nakamoto_peer_1_height + miner_1_blocks + min_num_miner_2_blocks, ) ;
4097
+ // Must be at least the number of blocks mined by miner 1 and the number of blocks mined by miner 2
4098
+ // before the fork was initiated
4099
+ assert ! ( peer_1_height >= pre_nakamoto_peer_1_height + miner_1_blocks + min_miner_2_blocks) ;
4108
4100
assert_eq ! (
4109
4101
btc_blocks_mined,
4110
4102
u64 :: try_from( miner_1_tenures + miner_2_tenures) . unwrap( )
0 commit comments