graph/db: tighten TestFilterChannelRangeVersionGuard assertions
What changed, and why it matters
This commit only changes a test file to make its assertions more precise. It does not modify any production code, so it cannot introduce a security vulnerability or fix one in running software. The change clarifies that one database backend should accept a request and return empty results, while another older backend should reject it with a specific error.
No security action needed. This is a test-only assertion refinement and can be reviewed as ordinary code quality.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff updates TestFilterChannelRangeVersionGuard in graph/db/graph_test.go. Previously the test accepted any non-nil error as the KV-backend sentinel error. The new code uses an isSQLDB flag to branch: for SQL backends it asserts no error and an empty response; for KV backends it asserts ErrVersionNotSupportedForKVDB. No runtime logic in graph/db is altered.
Changed components
graph/db/graph_test.goInspect captured patch +9 / −5
diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go
index 146b6d7..c5e8ce6 100644
--- a/graph/db/graph_test.go
+++ b/graph/db/graph_test.go
@@ -4403,14 +4403,18 @@ func TestFilterChannelRangeVersionGuard(t *testing.T) {
store := NewTestDB(t)
- _, err := store.FilterChannelRange(
+ resp, err := store.FilterChannelRange(
ctx, lnwire.GossipVersion2, 0, 1000, false,
)
- // The KV store does not support v2 and must return the sentinel error.
- // The SQL store accepts any known version (returning empty results
- // since no v2 channels have been added).
- if err != nil {
+ if isSQLDB {
+ // The SQL store accepts any known version and returns empty
+ // results since no v2 channels have been added.
+ require.NoError(t, err)
+ require.Empty(t, resp)
+ } else {
+ // The KV store does not support v2 and must return the
+ // sentinel error.
require.ErrorIs(t, err, ErrVersionNotSupportedForKVDB)
}
}
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.