File tree 1 file changed +21
-12
lines changed
1 file changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -1738,15 +1738,18 @@ impl EthApi {
1738
1738
return Ok ( ( ) ) ;
1739
1739
}
1740
1740
1741
- // mine all the blocks
1742
- for _ in 0 ..blocks. to :: < u64 > ( ) {
1743
- // If we have an interval, jump forwards in time to the "next" timestamp
1744
- if let Some ( interval) = interval {
1745
- self . backend . time ( ) . increase_time ( interval) ;
1741
+ self . on_blocking_task ( |this| async move {
1742
+ // mine all the blocks
1743
+ for _ in 0 ..blocks. to :: < u64 > ( ) {
1744
+ // If we have an interval, jump forwards in time to the "next" timestamp
1745
+ if let Some ( interval) = interval {
1746
+ this. backend . time ( ) . increase_time ( interval) ;
1747
+ }
1748
+ this. mine_one ( ) . await ;
1746
1749
}
1747
-
1748
- self . mine_one ( ) . await ;
1749
- }
1750
+ Ok ( ( ) )
1751
+ } )
1752
+ . await ? ;
1750
1753
1751
1754
Ok ( ( ) )
1752
1755
}
@@ -2630,10 +2633,16 @@ impl EthApi {
2630
2633
}
2631
2634
}
2632
2635
2633
- // mine all the blocks
2634
- for _ in 0 ..blocks_to_mine {
2635
- self . mine_one ( ) . await ;
2636
- }
2636
+ // this can be blocking for a bit, especially in forking mode
2637
+ // <https://github.com/foundry-rs/foundry/issues/6036>
2638
+ self . on_blocking_task ( |this| async move {
2639
+ // mine all the blocks
2640
+ for _ in 0 ..blocks_to_mine {
2641
+ this. mine_one ( ) . await ;
2642
+ }
2643
+ Ok ( ( ) )
2644
+ } )
2645
+ . await ?;
2637
2646
2638
2647
Ok ( blocks_to_mine)
2639
2648
}
You can’t perform that action at this time.
0 commit comments