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

sqldb/sqlc: add version filter and composite index for v1 node horizon query

Public commit record

What the developer wrote

Authored by Elle Mouton

73/100 · Adequate
sqldb/sqlc: add version filter and composite index for v1 node horizon query

The v1 GetNodesByLastUpdateRange query was missing an explicit
`WHERE version = 1` filter and used a single-column index on
`graph_nodes(last_update)` which didn't match the full query ordering
shape `ORDER BY last_update, pub_key`, requiring an extra sort step.

Add `WHERE version = 1` to the query for correctness and replace the
index with a composite `(version, last_update, pub_key)` index that
covers the filter, range scan, and pagination ordering together.

Note: the migration 000009_graph_v2 file is edited directly (dropping
the old index and creating the new one) rather than adding a new
migration, since this migration has not been included in a release yet.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a database query used to list Lightning Network graph nodes. The query now explicitly requests only 'version 1' nodes, which it should have been doing all along, and the matching database index is updated so the lookup stays fast. Without the version filter, the query could have returned newer-format (version 2) nodes to code that only understands version 1, potentially causing incorrect routing data or crashes. There is no direct evidence this was exploitable for theft of funds.

Recommended action

Treat as a correctness/performance improvement rather than an urgent security patch. Include in normal release testing; verify that v2 graph-node consumers use a separate query path so they are not affected by the new v1-only filter.

Security signals we found

01

Missing query predicate on version column could return unintended rows to v1-only consumers

02

Index change is defensive/performance-related, not a memory-safety or cryptographic fix

03

No vendor statement that this is a security vulnerability

04

No CVE, advisory, or researcher attribution present in commit materials

Risk score

Why this scored 18/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 2/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.