@@ -48,6 +48,7 @@ use crate::chainstate::nakamoto::tests::get_account;
48
48
use crate :: chainstate:: nakamoto:: tests:: node:: TestStacker ;
49
49
use crate :: chainstate:: nakamoto:: {
50
50
NakamotoBlock , NakamotoBlockObtainMethod , NakamotoChainState , NakamotoStagingBlocksConnRef ,
51
+ TEST_PROCESS_BLOCK_STALL ,
51
52
} ;
52
53
use crate :: chainstate:: stacks:: address:: PoxAddress ;
53
54
use crate :: chainstate:: stacks:: boot:: pox_4_tests:: { get_stacking_minimum, get_tip} ;
@@ -2495,6 +2496,7 @@ fn process_next_nakamoto_block_deadlock() {
2495
2496
info ! ( "Creating peer" ) ;
2496
2497
2497
2498
let mut peer = boot_plan. boot_into_nakamoto_peer ( vec ! [ ] , None ) ;
2499
+ let mut sortition_db = peer. sortdb ( ) . reopen ( ) . unwrap ( ) ;
2498
2500
let ( chainstate, _) = & mut peer
2499
2501
. stacks_node
2500
2502
. as_mut ( )
@@ -2503,20 +2505,26 @@ fn process_next_nakamoto_block_deadlock() {
2503
2505
. reopen ( )
2504
2506
. unwrap ( ) ;
2505
2507
2506
- // Lock the sortdb
2507
- info ! ( " ------------------------------- TRYING TO LOCK THE SORTDB" ) ;
2508
- let mut sortition_db = peer. sortdb ( ) . reopen ( ) . unwrap ( ) ;
2509
- let sort_tx = sortition_db. tx_begin ( ) . unwrap ( ) ;
2510
- info ! ( " ------------------------------- SORTDB LOCKED" ) ;
2508
+ TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) . replace ( true ) ;
2511
2509
2512
2510
let miner_thread = std:: thread:: spawn ( move || {
2513
2511
info ! ( " ------------------------------- MINING TENURE" ) ;
2514
2512
let ( block, burn_height, ..) =
2515
2513
peer. single_block_tenure ( & private_key, |_| { } , |_| { } , |_| true ) ;
2516
- peer. try_process_block ( & block) . unwrap ( ) ;
2517
2514
info ! ( " ------------------------------- TENURE MINED" ) ;
2518
2515
} ) ;
2519
2516
2517
+ // Wait a bit, to ensure the miner has reached the stall
2518
+ std:: thread:: sleep ( std:: time:: Duration :: from_secs ( 10 ) ) ;
2519
+
2520
+ // Lock the sortdb
2521
+ info ! ( " ------------------------------- TRYING TO LOCK THE SORTDB" ) ;
2522
+ let sort_tx = sortition_db. tx_begin ( ) . unwrap ( ) ;
2523
+ info ! ( " ------------------------------- SORTDB LOCKED" ) ;
2524
+
2525
+ // Un-stall the block processing
2526
+ TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) . replace ( false ) ;
2527
+
2520
2528
// Wait a bit, to ensure the tenure will have grabbed any locks it needs
2521
2529
std:: thread:: sleep ( std:: time:: Duration :: from_secs ( 10 ) ) ;
2522
2530
0 commit comments