What changed, and why it matters
This commit fixes a missing counter increment in a database migration that copies Lightning Network channel data from an old key-value store to a new SQL database. The `chunk` variable was supposed to count how many channels had been processed since the last progress report, but it never increased. As a result, progress logging and possibly batching logic would behave incorrectly, potentially making the migration appear stuck or run inefficiently. There is no direct evidence in the commit that this caused a security vulnerability.
Treat as a routine correctness fix. Review whether the stalled progress reporting could mask migration failures or cause operators to restart a long migration prematurely. No immediate security patch urgency is indicated by the diff alone.
Security signals we found
Missing counter increment in migration loop
Progress/batching logic silently disabled
Potential for long-running migration without status feedback
Evidence from the diff
In graph/db/sql_migration.go, inside migrateChannelsAndPolicies, a local chunk counter is reset to 0 and intended to be incremented each time a channel is migrated so that progress can be logged every chunkSize channels. The existing code incremented channelCount but omitted chunk++, so the chunk >= chunkSize condition would never become true and the progress-logging branch would never execute. The patch adds the missing chunk++. This is a correctness/robustness fix in migration tooling; the diff itself does not demonstrate an exploitable security flaw.
Changed components
graph/db/sql_migration.gomigrateChannelsAndPolicies functionInspect captured patch +2 / −0
diff --git a/graph/db/sql_migration.go b/graph/db/sql_migration.go
index 8a52976..0b06e7c 100644
--- a/graph/db/sql_migration.go
+++ b/graph/db/sql_migration.go
@@ -410,6 +410,8 @@ func migrateChannelsAndPolicies(ctx context.Context, kvBackend kvdb.Backend,
}
channelCount++
+ chunk++
+
err = migrateSingleChannel(
ctx, sqlDB, channel, policy1, policy2, migChanPolicy,
)
Why this scored 44/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.