graph/db: migration test for channels with no policies
What changed, and why it matters
This commit only adds a new test case to an existing database migration test file. It does not change any production code, fix a bug, or alter behavior. The test verifies that migrating channels without routing policies works correctly. There is no security issue visible in this change.
No action required; this is a test-only addition with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds a single sub-test named ‘channel with no policies’ to TestMigrateGraphToSQL in graph/db/sql_migration_test.go. It exercises the graph-to-SQL migration with channels that have unknown nodes, known nodes, and no auth proof/extra opaque data/features. Expected stats are 4 nodes and 3 channels. No production logic is modified.
Changed components
graph/db/sql_migration_test.goInspect captured patch +54 / −0
diff --git a/graph/db/sql_migration_test.go b/graph/db/sql_migration_test.go
index a752be4..13e3bff 100644
--- a/graph/db/sql_migration_test.go
+++ b/graph/db/sql_migration_test.go
@@ -175,6 +175,60 @@ func TestMigrateGraphToSQL(t *testing.T) {
},
expNotRetrySafety: true,
},
+ {
+ name: "channel with no policies",
+ write: writeUpdate,
+ objects: []any{
+ // A channel with unknown nodes. This will
+ // result in two shell nodes being created.
+ // - channel count += 1
+ // - node count += 2
+ makeTestChannel(t),
+
+ // Insert some nodes.
+ // - node count += 1
+ makeTestNode(t, func(n *models.LightningNode) {
+ n.PubKeyBytes = node1
+ }),
+ // - node count += 1
+ makeTestNode(t, func(n *models.LightningNode) {
+ n.PubKeyBytes = node2
+ }),
+
+ // A channel with known nodes.
+ // - channel count += 1
+ makeTestChannel(
+ t, func(c *models.ChannelEdgeInfo) {
+ c.ChannelID = chanID1
+
+ c.NodeKey1Bytes = node1
+ c.NodeKey2Bytes = node2
+ },
+ ),
+
+ // Insert a channel with no auth proof, no
+ // extra opaque data, and empty features.
+ // Use known nodes.
+ // - channel count += 1
+ makeTestChannel(
+ t, func(c *models.ChannelEdgeInfo) {
+ c.ChannelID = chanID2
+
+ c.NodeKey1Bytes = node1
+ c.NodeKey2Bytes = node2
+
+ c.AuthProof = nil
+ c.ExtraOpaqueData = nil
+ c.Features = testEmptyFeatures
+ },
+ ),
+ },
+ expGraphStats: graphStats{
+ numNodes: 4,
+ numChannels: 3,
+ },
+ expNotRetrySafety: true,
+ },
{
name: "channels and policies",
write: writeUpdate,
Why this scored 13/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.