Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start header task only when Sync.DownloadHeadersInFastSync=true #7393

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions src/Nethermind/Nethermind.Synchronization/Synchronizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,27 +319,26 @@ private void StartSnapSyncComponents()

private void StartFastBlocksComponents()
{
FastBlocksPeerAllocationStrategyFactory fastFactory = new();
SyncDispatcher<HeadersSyncBatch> headersDispatcher = CreateDispatcher(
HeadersSyncFeed,
new HeadersSyncDownloader(_logManager),
fastFactory
);

Task headersTask = headersDispatcher.Start(_syncCancellation!.Token).ContinueWith(t =>
{
if (t.IsFaulted)
{
if (_logger.IsError) _logger.Error("Fast blocks headers downloader failed", t.Exception);
}
else
{
if (_logger.IsInfo) _logger.Info("Fast blocks headers task completed.");
}
});

if (_syncConfig.DownloadHeadersInFastSync)
{
FastBlocksPeerAllocationStrategyFactory fastFactory = new();
SyncDispatcher<HeadersSyncBatch> headersDispatcher = CreateDispatcher(
HeadersSyncFeed,
new HeadersSyncDownloader(_logManager),
fastFactory
);

Task headersTask = headersDispatcher.Start(_syncCancellation!.Token).ContinueWith(t =>
{
if (t.IsFaulted)
{
if (_logger.IsError) _logger.Error("Fast blocks headers downloader failed", t.Exception);
}
else
{
if (_logger.IsInfo) _logger.Info("Fast blocks headers task completed.");
}
});
if (_syncConfig.DownloadBodiesInFastSync)
{

Expand Down