AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 58 Bitcoin

channeldb: recover missing db version

Public commit record

What the developer wrote

Authored by Elle Mouton

68/100 · Adequate
channeldb: recover missing db version

Use strict metadata reads during migration selection so a metadata bucket with a
missing metadata/dbp key is not interpreted as the latest DB version.

Recover this state from mandatory DB version 33, the last mandatory version
before the v0.20.x releases that could initialize a DB without writing the DB
version key. This runs migration 35 without replaying migrations 0 through 33
against a DB that was already created by a modern schema/code path.

After the selected migrations complete, syncVersions writes the latest DB
version as usual.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This patch fixes a database migration bug in LND's channel database. Some databases were created without recording their schema version number, which could cause future mandatory upgrades to be skipped. The fix detects that missing version marker, safely resumes upgrades from a known baseline, and ensures a specific v0.21 data-format migration (for 'waiting proof' records) actually runs. It is a correctness/reliability fix rather than a remote attack vector, but skipped migrations can leave data in an inconsistent state that may affect node behavior.

Recommended action

Apply the patch in the 0.21.2 release. Operators who initialized an LND node on affected v0.20.x code should upgrade so the waiting-proof migration runs and the DB version key is written. Monitor logs for the recovery warning. No immediate external mitigation is required because exploitation requires prior local DB state.

Security signals we found

01

Database schema version key can be absent due to an init-ordering regression

02

Missing version key previously caused migration selection to treat DB as latest, potentially skipping mandatory migrations

03

Fix recovers baseline from last mandatory version before the regression (33)

04

Specifically ensures waiting proof migration (35) runs on affected databases

05

Guard prevents unsafe inference on databases older than version 33

Risk score

Why this scored 58/100

Our methodology →
Potential impact 18/30
Exploitability 8/25
Stealth signal 10/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.