mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-20 13:27:27 +02:00
graph/db: fix address fetching error
This commit is contained in:
parent
272a2db16c
commit
714e528a3a
2 changed files with 7 additions and 11 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue