Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion op-chain-ops/cmd/celo-migrate/ancients.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func migrateAncientsDb(oldDBPath, newDBPath string, batchSize, bufferSize uint64
return numAncientsNewBefore, numAncientsNewBefore, nil
}

log.Info("Ancient Block Migration Started", "process", "ancients", "startBlock", numAncientsNewBefore, "endBlock", numAncientsOld, "count", numAncientsOld-numAncientsNewBefore, "step", batchSize)
log.Info("Ancient Block Migration Started", "process", "ancients", "startBlock", numAncientsNewBefore, "endBlock", numAncientsOld-1, "count", numAncientsOld-numAncientsNewBefore, "step", batchSize)

g, ctx := errgroup.WithContext(context.Background())
readChan := make(chan RLPBlockRange, bufferSize)
Expand Down
7 changes: 4 additions & 3 deletions op-chain-ops/cmd/celo-migrate/non-ancients.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ func migrateNonAncientsDb(oldDbPath, newDbPath string, numAncients, batchSize ui
// get the last block number
hash := rawdb.ReadHeadHeaderHash(newDB)
lastBlock := *rawdb.ReadHeaderNumber(newDB, hash)
lastAncient := numAncients - 1

log.Info("Non-Ancient Block Migration Started", "process", "non-ancients", "startBlock", numAncients, "endBlock", lastBlock, "count", lastBlock-numAncients, "lastAncientBlock", numAncients)
log.Info("Non-Ancient Block Migration Started", "process", "non-ancients", "startBlock", numAncients, "endBlock", lastBlock, "count", lastBlock-lastAncient, "lastAncientBlock", lastAncient)

for i := numAncients; i <= lastBlock; i += batchSize {
numbersHash := rawdb.ReadAllHashesInRange(newDB, i, i+batchSize-1)
Expand Down Expand Up @@ -88,8 +89,8 @@ func migrateNonAncientsDb(oldDbPath, newDbPath string, numAncients, batchSize ui
}
}

if numAncients > 0 {
toBeRemoved := rawdb.ReadAllHashesInRange(newDB, 1, numAncients)
if lastAncient > 0 {
toBeRemoved := rawdb.ReadAllHashesInRange(newDB, 1, lastAncient)
log.Info("Removing frozen blocks", "process", "non-ancients", "count", len(toBeRemoved))
batch := newDB.NewBatch()
for _, numberHash := range toBeRemoved {
Expand Down