@@ -113,7 +113,7 @@ struct SealingWork {
113113
114114pub struct Miner {
115115 mem_pool : Arc < RwLock < MemPool > > ,
116- next_allowed_reseal : Mutex < Instant > ,
116+ next_allowed_reseal : NextAllowedReseal ,
117117 next_mandatory_reseal : NextMandatoryReseal ,
118118 sealing_block_last_request : Mutex < u64 > ,
119119 sealing_work : Mutex < SealingWork > ,
@@ -129,6 +129,8 @@ pub struct Miner {
129129 immune_users : RwLock < HashSet < Address > > ,
130130}
131131
132+ type NextAllowedReseal = NextMandatoryReseal ;
133+
132134struct NextMandatoryReseal {
133135 instant : RwLock < Instant > ,
134136}
@@ -190,7 +192,7 @@ impl Miner {
190192
191193 Self {
192194 mem_pool,
193- next_allowed_reseal : Mutex :: new ( Instant :: now ( ) ) ,
195+ next_allowed_reseal : NextAllowedReseal :: new ( Instant :: now ( ) ) ,
194196 next_mandatory_reseal : NextMandatoryReseal :: new ( Instant :: now ( ) + options. reseal_max_period ) ,
195197 params : RwLock :: new ( AuthoringParams :: default ( ) ) ,
196198 sealing_block_last_request : Mutex :: new ( 0 ) ,
@@ -684,7 +686,7 @@ impl Miner {
684686
685687 /// Are we allowed to do a non-mandatory reseal?
686688 fn transaction_reseal_allowed ( & self ) -> bool {
687- self . sealing_enabled . load ( Ordering :: Relaxed ) && ( Instant :: now ( ) > * self . next_allowed_reseal . lock ( ) )
689+ self . sealing_enabled . load ( Ordering :: Relaxed ) && ( Instant :: now ( ) > self . next_allowed_reseal . get ( ) )
688690 }
689691
690692 fn map_pending_block < F , T > ( & self , f : F , latest_block_number : BlockNumber ) -> Option < T >
@@ -935,7 +937,7 @@ impl MinerService for Miner {
935937 }
936938
937939 // Sealing successful
938- * self . next_allowed_reseal . lock ( ) = Instant :: now ( ) + self . options . reseal_min_period ;
940+ self . next_allowed_reseal . set ( Instant :: now ( ) + self . options . reseal_min_period ) ;
939941 if !self . options . no_reseal_timer {
940942 chain. set_min_timer ( ) ;
941943 }
0 commit comments