Skip to content

Commit

Permalink
fix: respect first block in count x5
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Aug 7, 2024
1 parent ba6ccaa commit 799aac3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/app_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (a *AppManager) ProcessSnapshot(block *types.Block) {
}
}

totalBlocksCount := a.StateManager.GetBlocksCountSinceLatest(a.Config.StoreBlocks - a.Config.FirstBlock + 1)
totalBlocksCount := a.StateManager.GetBlocksCountSinceLatest(a.Config.StoreBlocks)
a.Logger.Info().
Int64("count", totalBlocksCount).
Int64("height", block.Height).
Expand Down Expand Up @@ -405,10 +405,10 @@ func (a *AppManager) PopulateBlocks() {
return
}

missingBlocks := a.StateManager.GetMissingBlocksSinceLatest(a.Config.StoreBlocks - a.Config.FirstBlock + 1)
missingBlocks := a.StateManager.GetMissingBlocksSinceLatest(a.Config.StoreBlocks)
if len(missingBlocks) == 0 {
a.Logger.Info().
Int64("count", a.Config.StoreBlocks-a.Config.FirstBlock+1).
Int64("count", a.Config.StoreBlocks).
Msg("Got enough blocks for populating")
a.IsPopulatingBlocks = false
return
Expand All @@ -417,11 +417,11 @@ func (a *AppManager) PopulateBlocks() {
blocksChunks := utils.SplitIntoChunks(missingBlocks, a.Config.Pagination.BlocksSearch)

for _, chunk := range blocksChunks {
count := a.StateManager.GetBlocksCountSinceLatest(a.Config.StoreBlocks - a.Config.FirstBlock + 1)
count := a.StateManager.GetBlocksCountSinceLatest(a.Config.StoreBlocks)

a.Logger.Info().
Int64("count", count).
Int64("required", a.Config.StoreBlocks-a.Config.FirstBlock-1).
Int64("required", a.Config.StoreBlocks).
Int("needed_blocks", len(chunk)).
Ints64("blocks", chunk).
Msg("Fetching more blocks...")
Expand Down

0 comments on commit 799aac3

Please sign in to comment.