@@ -113,7 +113,7 @@ struct SealingWork {
113
113
114
114
pub struct Miner {
115
115
mem_pool : Arc < RwLock < MemPool > > ,
116
- next_allowed_reseal : Mutex < Instant > ,
116
+ next_allowed_reseal : NextAllowedReseal ,
117
117
next_mandatory_reseal : NextMandatoryReseal ,
118
118
sealing_block_last_request : Mutex < u64 > ,
119
119
sealing_work : Mutex < SealingWork > ,
@@ -129,6 +129,8 @@ pub struct Miner {
129
129
immune_users : RwLock < HashSet < Address > > ,
130
130
}
131
131
132
+ type NextAllowedReseal = NextMandatoryReseal ;
133
+
132
134
struct NextMandatoryReseal {
133
135
instant : RwLock < Instant > ,
134
136
}
@@ -190,7 +192,7 @@ impl Miner {
190
192
191
193
Self {
192
194
mem_pool,
193
- next_allowed_reseal : Mutex :: new ( Instant :: now ( ) ) ,
195
+ next_allowed_reseal : NextAllowedReseal :: new ( Instant :: now ( ) ) ,
194
196
next_mandatory_reseal : NextMandatoryReseal :: new ( Instant :: now ( ) + options. reseal_max_period ) ,
195
197
params : RwLock :: new ( AuthoringParams :: default ( ) ) ,
196
198
sealing_block_last_request : Mutex :: new ( 0 ) ,
@@ -684,7 +686,7 @@ impl Miner {
684
686
685
687
/// Are we allowed to do a non-mandatory reseal?
686
688
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 ( ) )
688
690
}
689
691
690
692
fn map_pending_block < F , T > ( & self , f : F , latest_block_number : BlockNumber ) -> Option < T >
@@ -935,7 +937,7 @@ impl MinerService for Miner {
935
937
}
936
938
937
939
// 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 ) ;
939
941
if !self . options . no_reseal_timer {
940
942
chain. set_min_timer ( ) ;
941
943
}
0 commit comments