File tree Expand file tree Collapse file tree 2 files changed +21
-11
lines changed
Expand file tree Collapse file tree 2 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -261,12 +261,7 @@ impl BlockProducerStats {
261261 }
262262
263263 pub fn block_apply_start ( & mut self , time : redux:: Timestamp , hash : & BlockHash ) {
264- let is_our_block = self
265- . attempts
266- . back ( )
267- . and_then ( |v| v. block . as_ref ( ) )
268- . map_or ( false , |b| & b. hash == hash) ;
269- if !is_our_block {
264+ if !self . is_our_block ( hash) {
270265 return ;
271266 }
272267
@@ -319,6 +314,13 @@ impl BlockProducerStats {
319314 true
320315 } ) ;
321316 }
317+
318+ pub fn is_our_block ( & self , hash : & BlockHash ) -> bool {
319+ self . attempts
320+ . back ( )
321+ . and_then ( |v| v. block . as_ref ( ) )
322+ . map_or ( false , |b| & b. hash == hash)
323+ }
322324}
323325
324326impl From < & BlockProducerWonSlot > for BlockProductionAttemptWonSlot {
Original file line number Diff line number Diff line change @@ -247,16 +247,24 @@ impl TransitionFrontierSyncAction {
247247 } ;
248248 let hash = block. hash . clone ( ) ;
249249
250- // During catchup, we skip the verificationf of completed work and zkApp txn proofs
251- // until get closer to the best tip, at which point full verification is enabled.
252- // TODO(tizoc): locally produced blocks shouldn't be verified either
253- let skip_verification = super :: CATCHUP_BLOCK_VERIFY_TAIL_LENGTH
254- < store. state ( ) . transition_frontier . sync . pending_count ( ) ;
250+ let is_our_block;
255251
256252 if let Some ( stats) = store. service . stats ( ) {
257253 stats. block_producer ( ) . block_apply_start ( meta. time ( ) , & hash) ;
254+ // TODO(tizoc): try a better approach that doesn't need
255+ // to make use of the collected stats.
256+ is_our_block = stats. block_producer ( ) . is_our_block ( & hash) ;
257+ } else {
258+ is_our_block = false ;
258259 }
259260
261+ // During catchup, we skip the verificationf of completed work and zkApp txn proofs
262+ // until get closer to the best tip, at which point full verification is enabled.
263+ // We also skip verification of completed works if we produced this block.
264+ let skip_verification = is_our_block
265+ || super :: CATCHUP_BLOCK_VERIFY_TAIL_LENGTH
266+ < store. state ( ) . transition_frontier . sync . pending_count ( ) ;
267+
260268 store. dispatch ( LedgerWriteAction :: Init {
261269 request : LedgerWriteRequest :: BlockApply {
262270 block,
You can’t perform that action at this time.
0 commit comments