private void EnqueueForStandardProcessing(Block block)
        {
            while (_shelvedBlocks.TryDequeue(out Block? shelvedBlock))
            {
                if (_logger.IsInfo)
                {
                    _logger.Info($"Enqueuing previously shelved block {shelvedBlock.ToString(Block.Format.Short)}");
                }
                _standardProcessorQueue.Enqueue(shelvedBlock, ProcessingOptions.StoreReceipts);
            }

            if (_logger.IsDebug)
            {
                _logger.Debug("Enqueuing block for standard processing (skipping beam in full sync)");
            }
            _standardProcessorQueue.Enqueue(block, ProcessingOptions.StoreReceipts);
        }
        private void BeamProcess(Block block)
        {
            CancellationTokenSource cancellationToken = _tokens.GetOrAdd(block.Number, t => new CancellationTokenSource());

            if (block.IsGenesis)
            {
                _blockchainProcessor.Enqueue(block, ProcessingOptions.IgnoreParentNotOnMainChain);
                return;
            }

            // we only want to trace the actual block
            try
            {
                _recoveryStep.RecoverData(block);
                (IBlockchainProcessor processor, IStateReader stateReader) = CreateProcessor(block, new ReadOnlyDbProvider(_readOnlyDbProvider, true), _specProvider, _logManager);

                BlockHeader parentHeader = _readOnlyBlockTree.FindHeader(block.ParentHash, BlockTreeLookupOptions.TotalDifficultyNotNeeded);
                if (parentHeader != null)
                {
                    PrefetchNew(stateReader, block, parentHeader.StateRoot, parentHeader.Author ?? parentHeader.Beneficiary);
                }

                // Prefetch(block, parentHeader.StateRoot, parentHeader.Author ?? parentHeader.Beneficiary);
                // Prefetch(block, block.StateRoot, block.Author ?? block.Beneficiary);

                if (_logger.IsInfo)
                {
                    _logger.Info($"Now beam processing {block}");
                }
                Block processedBlock = null;
                Task  preProcessTask = Task.Run(() =>
                {
                    BeamSyncContext.MinimumDifficulty.Value = block.TotalDifficulty.Value;
                    BeamSyncContext.Description.Value       = $"[preProcess of {block.Hash.ToShortString()}]";
                    BeamSyncContext.LastFetchUtc.Value      = DateTime.UtcNow;
                    BeamSyncContext.Cancelled.Value         = cancellationToken.Token;
                    processedBlock = processor.Process(block, ProcessingOptions.ReadOnlyChain | ProcessingOptions.IgnoreParentNotOnMainChain, NullBlockTracer.Instance);
                    if (processedBlock == null)
                    {
                        if (_logger.IsInfo)
                        {
                            _logger.Info($"Block {block.ToString(Block.Format.Short)} skipped in beam sync");
                        }
                    }
                }).ContinueWith(t =>
                {
                    if (t.IsFaulted)
                    {
                        if (_logger.IsWarn)
                        {
                            _logger.Warn($"Stopped / failed to beam process block {block} | {t.Exception.Message}");
                        }
                        if (_logger.IsDebug)
                        {
                            _logger.Debug($"Details of beam sync failure {block} | {t.Exception}");
                        }

                        return;
                    }

                    if (processedBlock != null)
                    {
                        if (_logger.IsInfo)
                        {
                            _logger.Info($"Enqueuing for standard processing {block}");
                        }
                        // at this stage we are sure to have all the state available
                        _blockchainProcessor.Enqueue(block, ProcessingOptions.IgnoreParentNotOnMainChain);
                    }

                    processor.Dispose();
                });
            }
            catch (Exception e)
            {
                if (_logger.IsError)
                {
                    _logger.Error($"Block {block.ToString(Block.Format.Short)} failed processing and it will be skipped from beam sync", e);
                }
            }
        }