@@ -1393,8 +1393,8 @@ fn multiple_miners() {
1393
1393
config. node . p2p_bind = format ! ( "{localhost}:{node_1_p2p}" ) ;
1394
1394
config. node . data_url = format ! ( "http://{localhost}:{node_1_rpc}" ) ;
1395
1395
config. node . p2p_address = format ! ( "{localhost}:{node_1_p2p}" ) ;
1396
- config. node . pox_sync_sample_secs = 5 ;
1397
1396
config. miner . wait_on_interim_blocks = Duration :: from_secs ( 5 ) ;
1397
+ config. node . pox_sync_sample_secs = 1 ;
1398
1398
1399
1399
config. node . seed = btc_miner_1_seed. clone ( ) ;
1400
1400
config. node . local_peer_seed = btc_miner_1_seed. clone ( ) ;
@@ -1446,17 +1446,30 @@ fn multiple_miners() {
1446
1446
) ;
1447
1447
1448
1448
let mut run_loop_2 = boot_nakamoto:: BootRunLoop :: new ( conf_node_2. clone ( ) ) . unwrap ( ) ;
1449
+ let run_loop_stopper_2 = run_loop_2. get_termination_switch ( ) ;
1449
1450
let rl2_coord_channels = run_loop_2. coordinator_channels ( ) ;
1450
1451
let Counters {
1451
1452
naka_submitted_commits : rl2_commits,
1452
1453
..
1453
1454
} = run_loop_2. counters ( ) ;
1454
- let _run_loop_2_thread = thread:: Builder :: new ( )
1455
+ let run_loop_2_thread = thread:: Builder :: new ( )
1455
1456
. name ( "run_loop_2" . into ( ) )
1456
1457
. spawn ( move || run_loop_2. start ( None , 0 ) )
1457
1458
. unwrap ( ) ;
1458
1459
1459
1460
signer_test. boot_to_epoch_3 ( ) ;
1461
+
1462
+ wait_for ( 120 , || {
1463
+ let Some ( node_1_info) = get_chain_info_opt ( & conf) else {
1464
+ return Ok ( false ) ;
1465
+ } ;
1466
+ let Some ( node_2_info) = get_chain_info_opt ( & conf_node_2) else {
1467
+ return Ok ( false ) ;
1468
+ } ;
1469
+ Ok ( node_1_info. stacks_tip_height == node_2_info. stacks_tip_height )
1470
+ } )
1471
+ . expect ( "Timed out waiting for boostrapped node to catch up to the miner" ) ;
1472
+
1460
1473
let pre_nakamoto_peer_1_height = get_chain_info ( & conf) . stacks_tip_height ;
1461
1474
1462
1475
info ! ( "------------------------- Reached Epoch 3.0 -------------------------" ) ;
@@ -1553,6 +1566,12 @@ fn multiple_miners() {
1553
1566
u64 :: try_from( miner_1_tenures + miner_2_tenures) . unwrap( )
1554
1567
) ;
1555
1568
1569
+ rl2_coord_channels
1570
+ . lock ( )
1571
+ . expect ( "Mutex poisoned" )
1572
+ . stop_chains_coordinator ( ) ;
1573
+ run_loop_stopper_2. store ( false , Ordering :: SeqCst ) ;
1574
+ run_loop_2_thread. join ( ) . unwrap ( ) ;
1556
1575
signer_test. shutdown ( ) ;
1557
1576
}
1558
1577
@@ -1728,6 +1747,18 @@ fn miner_forking() {
1728
1747
. unwrap ( ) ;
1729
1748
1730
1749
signer_test. boot_to_epoch_3 ( ) ;
1750
+
1751
+ wait_for ( 120 , || {
1752
+ let Some ( node_1_info) = get_chain_info_opt ( & conf) else {
1753
+ return Ok ( false ) ;
1754
+ } ;
1755
+ let Some ( node_2_info) = get_chain_info_opt ( & conf_node_2) else {
1756
+ return Ok ( false ) ;
1757
+ } ;
1758
+ Ok ( node_1_info. stacks_tip_height == node_2_info. stacks_tip_height )
1759
+ } )
1760
+ . expect ( "Timed out waiting for boostrapped node to catch up to the miner" ) ;
1761
+
1731
1762
let pre_nakamoto_peer_1_height = get_chain_info ( & conf) . stacks_tip_height ;
1732
1763
1733
1764
naka_skip_commit_op. 0 . lock ( ) . unwrap ( ) . replace ( false ) ;
@@ -3403,18 +3434,31 @@ fn multiple_miners_with_nakamoto_blocks() {
3403
3434
let http_origin = format ! ( "http://{}" , & conf. node. rpc_bind) ;
3404
3435
3405
3436
let mut run_loop_2 = boot_nakamoto:: BootRunLoop :: new ( conf_node_2. clone ( ) ) . unwrap ( ) ;
3437
+ let run_loop_stopper_2 = run_loop_2. get_termination_switch ( ) ;
3406
3438
let rl2_coord_channels = run_loop_2. coordinator_channels ( ) ;
3407
3439
let Counters {
3408
3440
naka_submitted_commits : rl2_commits,
3409
3441
naka_mined_blocks : blocks_mined2,
3410
3442
..
3411
3443
} = run_loop_2. counters ( ) ;
3412
- let _run_loop_2_thread = thread:: Builder :: new ( )
3444
+ let run_loop_2_thread = thread:: Builder :: new ( )
3413
3445
. name ( "run_loop_2" . into ( ) )
3414
3446
. spawn ( move || run_loop_2. start ( None , 0 ) )
3415
3447
. unwrap ( ) ;
3416
3448
3417
3449
signer_test. boot_to_epoch_3 ( ) ;
3450
+
3451
+ wait_for ( 120 , || {
3452
+ let Some ( node_1_info) = get_chain_info_opt ( & conf) else {
3453
+ return Ok ( false ) ;
3454
+ } ;
3455
+ let Some ( node_2_info) = get_chain_info_opt ( & conf_node_2) else {
3456
+ return Ok ( false ) ;
3457
+ } ;
3458
+ Ok ( node_1_info. stacks_tip_height == node_2_info. stacks_tip_height )
3459
+ } )
3460
+ . expect ( "Timed out waiting for follower to catch up to the miner" ) ;
3461
+
3418
3462
let pre_nakamoto_peer_1_height = get_chain_info ( & conf) . stacks_tip_height ;
3419
3463
3420
3464
info ! ( "------------------------- Reached Epoch 3.0 -------------------------" ) ;
@@ -3536,7 +3580,12 @@ fn multiple_miners_with_nakamoto_blocks() {
3536
3580
btc_blocks_mined,
3537
3581
u64 :: try_from( miner_1_tenures + miner_2_tenures) . unwrap( )
3538
3582
) ;
3539
-
3583
+ rl2_coord_channels
3584
+ . lock ( )
3585
+ . expect ( "Mutex poisoned" )
3586
+ . stop_chains_coordinator ( ) ;
3587
+ run_loop_stopper_2. store ( false , Ordering :: SeqCst ) ;
3588
+ run_loop_2_thread. join ( ) . unwrap ( ) ;
3540
3589
signer_test. shutdown ( ) ;
3541
3590
}
3542
3591
@@ -3575,6 +3624,7 @@ fn partial_tenure_fork() {
3575
3624
3576
3625
let node_1_rpc_bind = format ! ( "127.0.0.1:{}" , node_1_rpc) ;
3577
3626
3627
+ let localhost = "127.0.0.1" ;
3578
3628
// All signers are listening to node 1
3579
3629
let mut signer_test: SignerTest < SpawnedSigner > = SignerTest :: new_with_config_modifications (
3580
3630
num_signers,
@@ -3586,11 +3636,12 @@ fn partial_tenure_fork() {
3586
3636
signer_config. node_host = node_1_rpc_bind. clone ( ) ;
3587
3637
} ,
3588
3638
|config| {
3589
- let localhost = "127.0.0.1" ;
3590
- config. node . rpc_bind = format ! ( "{}:{}" , localhost, node_1_rpc) ;
3591
- config. node . p2p_bind = format ! ( "{}:{}" , localhost, node_1_p2p) ;
3592
- config. node . data_url = format ! ( "http://{}:{}" , localhost, node_1_rpc) ;
3593
- config. node . p2p_address = format ! ( "{}:{}" , localhost, node_1_p2p) ;
3639
+ config. node . rpc_bind = format ! ( "{localhost}:{node_1_rpc}" ) ;
3640
+ config. node . p2p_bind = format ! ( "{localhost}:{node_1_p2p}" ) ;
3641
+ config. node . data_url = format ! ( "http://{localhost}:{node_1_rpc}" ) ;
3642
+ config. node . p2p_address = format ! ( "{localhost}:{node_1_p2p}" ) ;
3643
+ config. miner . wait_on_interim_blocks = Duration :: from_secs ( 5 ) ;
3644
+ config. node . pox_sync_sample_secs = 1 ;
3594
3645
3595
3646
config. node . seed = btc_miner_1_seed. clone ( ) ;
3596
3647
config. node . local_peer_seed = btc_miner_1_seed. clone ( ) ;
@@ -3620,11 +3671,10 @@ fn partial_tenure_fork() {
3620
3671
3621
3672
let conf = signer_test. running_nodes . conf . clone ( ) ;
3622
3673
let mut conf_node_2 = conf. clone ( ) ;
3623
- let localhost = "127.0.0.1" ;
3624
- conf_node_2. node . rpc_bind = format ! ( "{}:{}" , localhost, node_2_rpc) ;
3625
- conf_node_2. node . p2p_bind = format ! ( "{}:{}" , localhost, node_2_p2p) ;
3626
- conf_node_2. node . data_url = format ! ( "http://{}:{}" , localhost, node_2_rpc) ;
3627
- conf_node_2. node . p2p_address = format ! ( "{}:{}" , localhost, node_2_p2p) ;
3674
+ conf_node_2. node . rpc_bind = format ! ( "{localhost}:{node_2_rpc}" ) ;
3675
+ conf_node_2. node . p2p_bind = format ! ( "{localhost}:{node_2_p2p}" ) ;
3676
+ conf_node_2. node . data_url = format ! ( "http://{localhost}:{node_2_rpc}" ) ;
3677
+ conf_node_2. node . p2p_address = format ! ( "{localhost}:{node_2_p2p}" ) ;
3628
3678
conf_node_2. node . seed = btc_miner_2_seed. clone ( ) ;
3629
3679
conf_node_2. burnchain . local_mining_public_key = Some ( btc_miner_2_pk. to_hex ( ) ) ;
3630
3680
conf_node_2. node . local_peer_seed = btc_miner_2_seed. clone ( ) ;
@@ -3646,14 +3696,16 @@ fn partial_tenure_fork() {
3646
3696
let http_origin = format ! ( "http://{}" , & conf. node. rpc_bind) ;
3647
3697
3648
3698
let mut run_loop_2 = boot_nakamoto:: BootRunLoop :: new ( conf_node_2. clone ( ) ) . unwrap ( ) ;
3699
+ let rl2_coord_channels = run_loop_2. coordinator_channels ( ) ;
3700
+ let run_loop_stopper_2 = run_loop_2. get_termination_switch ( ) ;
3649
3701
let Counters {
3650
3702
naka_mined_blocks : blocks_mined2,
3651
3703
naka_proposed_blocks : blocks_proposed2,
3652
3704
..
3653
3705
} = run_loop_2. counters ( ) ;
3654
3706
3655
3707
signer_test. boot_to_epoch_3 ( ) ;
3656
- let _run_loop_2_thread = thread:: Builder :: new ( )
3708
+ let run_loop_2_thread = thread:: Builder :: new ( )
3657
3709
. name ( "run_loop_2" . into ( ) )
3658
3710
. spawn ( move || run_loop_2. start ( None , 0 ) )
3659
3711
. unwrap ( ) ;
@@ -3918,7 +3970,12 @@ fn partial_tenure_fork() {
3918
3970
. unwrap ( )
3919
3971
. unwrap ( ) ;
3920
3972
assert_eq ! ( tip. stacks_block_height, ignore_block - 1 ) ;
3921
-
3973
+ rl2_coord_channels
3974
+ . lock ( )
3975
+ . expect ( "Mutex poisoned" )
3976
+ . stop_chains_coordinator ( ) ;
3977
+ run_loop_stopper_2. store ( false , Ordering :: SeqCst ) ;
3978
+ run_loop_2_thread. join ( ) . unwrap ( ) ;
3922
3979
signer_test. shutdown ( ) ;
3923
3980
}
3924
3981
0 commit comments