Skip to content

Commit

Permalink
Fix bodies not finishing
Browse files Browse the repository at this point in the history
  • Loading branch information
smartprogrammer93 committed Nov 4, 2023
1 parent 60eef60 commit 7bf3b7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class BodiesSyncFeed : ActivatedSyncFeed<BodiesSyncBatch?>
private readonly ISyncPeerPool _syncPeerPool;
private readonly IDbMeta _blocksDb;
private readonly IDb _metadataDb;
public override bool IsFinished => (_blockTree.LowestInsertedBodyNumber ?? long.MaxValue) <= _barrier;

private long _pivotNumber;
private long _barrier;
Expand All @@ -45,7 +44,7 @@ public class BodiesSyncFeed : ActivatedSyncFeed<BodiesSyncBatch?>
private SyncStatusList _syncStatusList;

private bool ShouldFinish => !_syncConfig.DownloadBodiesInFastSync || AllDownloaded;
private bool AllDownloaded => _blockTree.LowestInsertedBodyNumber <= _barrier
private bool AllDownloaded => (_blockTree.LowestInsertedBodyNumber ?? long.MaxValue) <= _barrier
|| WithinOldBarrierDefault;

// This property was introduced when we switched defaults of barriers from 11052984 to 0 to not disturb existing node operators
Expand All @@ -54,6 +53,7 @@ public class BodiesSyncFeed : ActivatedSyncFeed<BodiesSyncBatch?>
&& _blockTree.LowestInsertedBodyNumber <= DepositContractBarrier
&& _blockTree.LowestInsertedBodyNumber > DepositContractBarrier - GethSyncLimits.MaxBodyFetch;

public override bool IsFinished => AllDownloaded;
public BodiesSyncFeed(
ISpecProvider specProvider,
IBlockTree blockTree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ReceiptsSyncFeed : ActivatedSyncFeed<ReceiptsSyncBatch?>
private long? _barrierWhenStarted;

private bool ShouldFinish => !_syncConfig.DownloadReceiptsInFastSync || AllDownloaded;
private bool AllDownloaded => _receiptStorage.LowestInsertedReceiptBlockNumber <= _barrier
private bool AllDownloaded => (_receiptStorage.LowestInsertedReceiptBlockNumber ?? long.MaxValue) <= _barrier
|| WithinOldBarrierDefault;

// This property was introduced when we switched defaults of barriers on mainnet from 11052984 to 0 to not disturb existing node operators
Expand Down

0 comments on commit 7bf3b7d

Please sign in to comment.