mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 01:22:51 +02:00
graph/db+sqldb: remove LEFT JOIN for fetching node addresses
In this commit, we remove the LEFT JOIN query that was used for fetching a nodes addresses. The reason it was used before was to ensure that we'd get an empty address list if the node did exist but had no addresses. This was for the purposes of the `AddrsForNode` method since it needs to return false/true to indicate if the given node exists.
This commit is contained in:
@@ -134,12 +134,11 @@ INSERT INTO graph_node_addresses (
|
||||
$1, $2, $3, $4
|
||||
);
|
||||
|
||||
-- name: GetNodeAddressesByPubKey :many
|
||||
SELECT a.type, a.address
|
||||
FROM graph_nodes n
|
||||
LEFT JOIN graph_node_addresses a ON a.node_id = n.id
|
||||
WHERE n.pub_key = $1 AND n.version = $2
|
||||
ORDER BY a.type ASC, a.position ASC;
|
||||
-- name: GetNodeAddresses :many
|
||||
SELECT type, address
|
||||
FROM graph_node_addresses
|
||||
WHERE node_id = $1
|
||||
ORDER BY type ASC, position ASC;
|
||||
|
||||
-- name: GetNodesByLastUpdateRange :many
|
||||
SELECT *
|
||||
|
Reference in New Issue
Block a user