Fix migration for clean database (#2097)

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
This commit is contained in:
ledgerwatch 2021-06-04 15:08:22 +01:00 committed by GitHub
parent 7cd8046c35
commit 5a54eab268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ var rebuilCallTraceIndex = Migration{
}
if !sm.CallTraces {
// Call traces are not on, nothing to migrate
return nil
return CommitProgress(db, nil, true)
}
// Find the lowest key in the TraceCallSet table
tx := db.(ethdb.HasTx).Tx()
@ -35,12 +35,12 @@ var rebuilCallTraceIndex = Migration{
}
if k == nil {
log.Warn("Nothing to rebuild, CallTraceSet table is empty")
return nil
return CommitProgress(db, nil, true)
}
blockNum := binary.BigEndian.Uint64((k))
if blockNum == 0 {
log.Warn("Nothing to rebuild, CallTraceSet's first record", "number", blockNum)
return nil
return CommitProgress(db, nil, true)
}
log.Info("First record in CallTraceTable", "number", blockNum)
if err = stages.SaveStageUnwind(db, stages.CallTraces, blockNum-1); err != nil {