@@ -270,27 +270,29 @@ lazy_static! {
270
270
] ;
271
271
}
272
272
273
- // Cause an artifical stall in block-processing, for testing.
274
- #[ cfg( any( test, feature = "testing" ) ) ]
275
- pub static TEST_PROCESS_BLOCK_STALL : std:: sync:: Mutex < Option < bool > > = std:: sync:: Mutex :: new ( None ) ;
276
-
277
- fn stall_block_processing ( ) {
278
- if * TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) == Some ( true ) {
279
- // Do an extra check just so we don't log EVERY time.
280
- warn ! ( "Block processing is stalled due to testing directive." ) ;
281
- while * TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) == Some ( true ) {
282
- std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 10 ) ) ;
273
+ #[ cfg( test) ]
274
+ mod test_stall {
275
+ pub static TEST_PROCESS_BLOCK_STALL : std:: sync:: Mutex < Option < bool > > =
276
+ std:: sync:: Mutex :: new ( None ) ;
277
+
278
+ pub fn stall_block_processing ( ) {
279
+ if * TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) == Some ( true ) {
280
+ // Do an extra check just so we don't log EVERY time.
281
+ warn ! ( "Block processing is stalled due to testing directive." ) ;
282
+ while * TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) == Some ( true ) {
283
+ std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 10 ) ) ;
284
+ }
285
+ info ! ( "Block processing is no longer stalled due to testing directive." ) ;
283
286
}
284
- info ! ( "Block processing is no longer stalled due to testing directive." ) ;
285
287
}
286
- }
287
288
288
- pub fn enable_process_block_stall ( ) {
289
- TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) . replace ( true ) ;
290
- }
289
+ pub fn enable_process_block_stall ( ) {
290
+ TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) . replace ( true ) ;
291
+ }
291
292
292
- pub fn disable_process_block_stall ( ) {
293
- TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) . replace ( false ) ;
293
+ pub fn disable_process_block_stall ( ) {
294
+ TEST_PROCESS_BLOCK_STALL . lock ( ) . unwrap ( ) . replace ( false ) ;
295
+ }
294
296
}
295
297
296
298
/// Trait for common MARF getters between StacksDBConn and StacksDBTx
@@ -1745,8 +1747,8 @@ impl NakamotoChainState {
1745
1747
canonical_sortition_tip : & SortitionId ,
1746
1748
dispatcher_opt : Option < & ' a T > ,
1747
1749
) -> Result < Option < StacksEpochReceipt > , ChainstateError > {
1748
- #[ cfg( any ( test, feature = "testing" ) ) ]
1749
- stall_block_processing ( ) ;
1750
+ #[ cfg( test) ]
1751
+ test_stall :: stall_block_processing ( ) ;
1750
1752
1751
1753
let nakamoto_blocks_db = stacks_chain_state. nakamoto_blocks_db ( ) ;
1752
1754
let Some ( ( next_ready_block, block_size) ) =
0 commit comments