graph/db: fix address fetching error
This commit is contained in:
2 files changed
+7
-11
No files matched your search
+1
-11
@@ -190,17 +190,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
|||||||
// Fetch the node and assert the empty addresses.
|
// Fetch the node and assert the empty addresses.
|
||||||
dbNode, err = graph.FetchLightningNode(ctx, testPub)
|
dbNode, err = graph.FetchLightningNode(ctx, testPub)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
compareNodes(t, node, dbNode)
|
||||||
// Temporarily have a special case for SQLStore, as currently, it does
|
|
||||||
// not correctly handle empty addresses. We assert this incorrect
|
|
||||||
// behaviour here in order to demonstrate the bug. This will be fixed in
|
|
||||||
// an upcoming commit.
|
|
||||||
if _, ok := graph.V1Store.(*SQLStore); ok {
|
|
||||||
require.Empty(t, dbNode.Addresses)
|
|
||||||
require.NotEqual(t, node.Addresses, dbNode.Addresses)
|
|
||||||
} else {
|
|
||||||
compareNodes(t, node, dbNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
known, addrs, err = graph.AddrsForNode(ctx, pub)
|
known, addrs, err = graph.AddrsForNode(ctx, pub)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -3619,6 +3619,12 @@ func getNodeAddresses(ctx context.Context, db SQLQueries, nodePub []byte) (bool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have no addresses, then we'll return nil instead of an
|
||||||
|
// empty slice.
|
||||||
|
if len(addresses) == 0 {
|
||||||
|
addresses = nil
|
||||||
|
}
|
||||||
|
|
||||||
return true, addresses, nil
|
return true, addresses, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user