mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-25 19:38:05 +02:00
graph/db: fix address fetching error
This commit is contained in:
@@ -190,17 +190,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
||||
// Fetch the node and assert the empty addresses.
|
||||
dbNode, err = graph.FetchLightningNode(ctx, testPub)
|
||||
require.NoError(t, err)
|
||||
|
||||
// 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)
|
||||
}
|
||||
compareNodes(t, node, dbNode)
|
||||
|
||||
known, addrs, err = graph.AddrsForNode(ctx, pub)
|
||||
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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user