Skip to content

Commit

Permalink
Don't start snap sync unless it's near the tip enough (#7834)
Browse files Browse the repository at this point in the history
  • Loading branch information
flcl42 authored Nov 28, 2024
1 parent e0f1713 commit 5516619
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Nethermind/Chains/taiko-mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Taiko Mainnet",
"dataDir": "taiko-mainnet",
"engine": {
"Taiko": { }
"Taiko": {}
},
"params": {
"chainId": "167000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Nethermind.Blockchain.Synchronization;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.State.Snap;
using Nethermind.Synchronization.Peers;

namespace Nethermind.Synchronization.ParallelSync
Expand Down Expand Up @@ -636,8 +635,7 @@ private bool ShouldBeInStateNodesMode(Snapshot best)
{
LogDetailedSyncModeChecks("STATE_NODES",
(nameof(isInStateSync), isInStateSync),
(nameof(snapSyncDisabled), snapSyncDisabled),
(nameof(snapRangesFinished), snapRangesFinished));
($"{nameof(snapSyncDisabled)}||{nameof(snapRangesFinished)}", snapSyncDisabled || snapRangesFinished));
}

return result;
Expand All @@ -646,7 +644,7 @@ private bool ShouldBeInStateNodesMode(Snapshot best)
private bool ShouldBeInSnapRangesPhase(Snapshot best)
{
bool isInStateSync = best.IsInStateSync;
bool isCloseToHead = best.TargetBlock >= best.Header && (best.TargetBlock - best.Header) < Constants.MaxDistanceFromHead;
bool isCloseToHead = best.TargetBlock >= best.Header && (best.TargetBlock - best.Header) <= FastSyncLag;
bool snapNotFinished = !_syncProgressResolver.IsSnapGetRangesFinished();

if (_logger.IsTrace)
Expand Down

0 comments on commit 5516619

Please sign in to comment.