What changed, and why it matters
This commit fixes progress logging counters in database migration code. Three migration functions were incrementing a 'count' variable but not a separate 'chunk' variable, which is likely used to decide when to print progress updates. The fix adds the missing 'chunk++' increments so progress logs are emitted at the intended intervals. There is no security relevance visible in the code change.
No security action required. Treat as a normal logging-correctness fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In graph/db/sql_migration.go, the functions migratePruneLog, migrateClosedSCIDIndex, and migrateZombieIndex each iterate over database records during migration and increment a ‘count’ variable per record. They also maintain a ‘chunk’ counter that appears to drive periodic progress logging (e.g., log every N records). The bug was that ‘chunk’ was never incremented, so the progress-log threshold condition (likely chunk % batchSize == 0) would never trigger. The patch adds ‘chunk++’ alongside each ‘count++’. This is a logging/metrics correctness fix with no functional change to migration behavior or data integrity.
Changed components
graph/db/sql_migration.gomigratePruneLogmigrateClosedSCIDIndexmigrateZombieIndexInspect captured patch +3 / −0
diff --git a/graph/db/sql_migration.go b/graph/db/sql_migration.go
index 0b06e7c..4d337ad 100644
--- a/graph/db/sql_migration.go
+++ b/graph/db/sql_migration.go
@@ -603,6 +603,7 @@ func migratePruneLog(ctx context.Context, kvBackend kvdb.Backend,
hash *chainhash.Hash) error {
count++
+ chunk++
// Keep track of the prune tip height and hash.
if height > pruneTipHeight {
@@ -786,6 +787,7 @@ func migrateClosedSCIDIndex(ctx context.Context, kvBackend kvdb.Backend,
)
migrateSingleClosedSCID := func(scid lnwire.ShortChannelID) error {
count++
+ chunk++
chanIDB := channelIDToBytes(scid.ToUint64())
err := sqlDB.InsertClosedChannel(ctx, chanIDB)
@@ -874,6 +876,7 @@ func migrateZombieIndex(ctx context.Context, kvBackend kvdb.Backend,
}
count++
+ chunk++
err = sqlDB.UpsertZombieChannel(
ctx, sqlc.UpsertZombieChannelParams{
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.