@@ -225,9 +225,21 @@ func (e *Engine) processQueuedBlocks(doneSignal <-chan struct{}) error {
225225 blocks = append (blocks , block .Block .ToInternal ())
226226 }
227227
228+ firstBlock := blocks [0 ].Header
229+ lastBlock := blocks [len (blocks )- 1 ].Header
230+ log := e .log .With ().
231+ Hex ("origin_id" , batch .OriginID [:]).
232+ Str ("chain_id" , lastBlock .ChainID .String ()).
233+ Uint64 ("first_block_height" , firstBlock .Height ).
234+ Uint64 ("first_block_view" , firstBlock .View ).
235+ Uint64 ("last_block_height" , lastBlock .Height ).
236+ Uint64 ("last_block_view" , lastBlock .View ).
237+ Int ("range_length" , len (blocks )).
238+ Logger ()
239+
228240 latestFinalizedView := e .finalizedBlockTracker .NewestBlock ().View
229241 submitConnectedBatch := func (blocks []* flow.Block ) {
230- e .submitConnectedBatch (latestFinalizedView , batch .OriginID , blocks )
242+ e .submitConnectedBatch (log , latestFinalizedView , batch .OriginID , blocks )
231243 }
232244
233245 // extract sequences of connected blocks and schedule them for further processing
@@ -253,21 +265,23 @@ func (e *Engine) processQueuedBlocks(doneSignal <-chan struct{}) error {
253265}
254266
255267// submitConnectedBatch checks if batch is still pending and submits it via channel for further processing by worker goroutines.
256- func (e * Engine ) submitConnectedBatch (latestFinalizedView uint64 , originID flow.Identifier , blocks []* flow.Block ) {
268+ func (e * Engine ) submitConnectedBatch (log zerolog. Logger , latestFinalizedView uint64 , originID flow.Identifier , blocks []* flow.Block ) {
257269 if len (blocks ) < 1 {
258270 return
259271 }
260272 // if latest block of batch is already finalized we can drop such input.
261- if blocks [len (blocks )- 1 ].Header .View < latestFinalizedView {
273+ lastBlock := blocks [len (blocks )- 1 ].Header
274+ if lastBlock .View < latestFinalizedView {
275+ log .Debug ().Msgf ("dropping range [%d, %d] below finalized view %d" , blocks [0 ].Header .View , lastBlock .View , latestFinalizedView )
262276 return
263277 }
264- msg := flow.Slashable [[]* flow.Block ]{
265- OriginID : originID ,
266- Message : blocks ,
267- }
278+ log .Debug ().Msgf ("submitting sub-range [%d, %d] for further processing" , blocks [0 ].Header .View , lastBlock .View )
268279
269280 select {
270- case e .pendingConnectedBlocksChan <- msg :
281+ case e .pendingConnectedBlocksChan <- flow.Slashable [[]* flow.Block ]{
282+ OriginID : originID ,
283+ Message : blocks ,
284+ }:
271285 case <- e .ComponentManager .ShutdownSignal ():
272286 }
273287}
0 commit comments