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

graph/db: version FilterChannelRange

Public commit record

What the developer wrote

Authored by Elle Mouton

73/100 · Adequate
graph/db: version FilterChannelRange

Add a gossip version parameter to FilterChannelRange in the Store interface,
both KV and SQL implementations, and the ChannelGraph wrapper.

KVStore guards against non-v1 versions with ErrVersionNotSupportedForKVDB.
SQLStore accepts any known gossip version, filtering the channel results by
version and using it in policy lookups. The SQL query still uses
GetPublicV1ChannelsBySCID for now (a TODO marks where a version-aware query
will be substituted in a follow-up).

VersionedGraph.FilterChannelRange shadows the ChannelGraph method with a
version-free signature, passing its baked-in version to the store. This keeps
the ChannelGraphTimeSeries interface and ChanSeries implementation unchanged.

Add TestFilterChannelRangeVersionGuard to verify that the KV store returns
ErrVersionNotSupportedForKVDB for v2 requests while the SQL store handles
them gracefully.
✓ Descriptive subject✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit changes how LND's graph database filters channel ranges by adding a 'gossip version' parameter. It is a preparatory/infrastructure change: the older KV database now explicitly refuses version 2 requests, while the newer SQL database accepts them but still mostly uses the old version-1 query path (marked with a TODO for a future update). There is no obvious security vulnerability in the patch itself; it is more about making the code ready for future gossip protocol versions.

Recommended action

Treat as a normal feature/infrastructure commit. Review the follow-up TODO to replace GetPublicV1ChannelsBySCID with a version-aware SQL query, since leaving version filtering in application code could have performance or correctness implications. No immediate security patch is indicated by this commit alone.

Security signals we found

01

API signature change to enforce version-aware channel range filtering

02

KV store hard-rejects unsupported gossip versions with a sentinel error

03

SQL store filters by version in application code but still queries a v1-specific SQL helper (TODO noted)

04

Policy lookups in SQL store now use the requested gossip version instead of hard-coded GossipVersion1

05

New unit test covers version guard behavior for KV vs SQL backends

Risk score

Why this scored 28/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 5/15
Affected reach 5/15
Confidence 7/10
Evidence quality 3/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.