lnd: add clarifiying comment when introducing a new db
What changed, and why it matters
This commit only adds a clarifying code comment. No code behavior changes. It warns future developers that when promoting database migrations from test to production, they must also update which backend is used, otherwise production builds might keep using the older KV backend instead of the newer native SQL backend. There is no security vulnerability in this change itself.
No action required. This is a documentation-only commit. Developers should follow the guidance in the comment when promoting migrations in future changes.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a 10-line comment block in config_prod.go explaining that build-tag-specific overrides in config_prod.go and config_test_native_sql.go control backend selection for certain stores. It notes that if a migration is promoted from sqldb/migrations_dev.go to sqldb/migrations.go, the corresponding UseNativeSQL branch in BuildDatabase (config_builder.go) must also be updated. This is documentation-only; no logic, build tags, or migration code is modified.
Changed components
config_prod.goInspect captured patch +10 / −0
diff --git a/config_prod.go b/config_prod.go
index 60dba8b..1b0a5c5 100644
--- a/config_prod.go
+++ b/config_prod.go
@@ -9,6 +9,16 @@ import (
"github.com/lightningnetwork/lnd/sqldb/sqlc"
)
+// NOTE: This file (together with config_test_native_sql.go) contains
+// build-tag-specific overrides that control which backend is used for certain
+// stores. If any function in either file switches a store between KV and native
+// SQL depending on the build tag, and the corresponding migration is later
+// promoted from sqldb/migrations_dev.go into the mainline sqldb/migrations.go,
+// you must also update the UseNativeSQL branch in BuildDatabase
+// (config_builder.go) to use the native SQL backend for that store. Promoting
+// the migration without updating the store means the production build will
+// continue writing to the KV backend instead of SQL.
+
// RunTestSQLMigration is a build tag that indicates whether the test_native_sql
// build tag is set.
var RunTestSQLMigration = false
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.