graph+lnd: add various calls to GraphSource

In this commit, we add a bunch of graph methods to the GraphSource, let
DBSource implement it and then we use the graph source for these
methods for the GetNodeInfo, VerifyMessage, DescribeGraph,
GetNodeMetrics, GetChanInfo and GetNodeInfo RPC calls along with peer
alias lookup.
This commit is contained in:
Elle Mouton
2024-11-12 08:24:32 +02:00
parent bfe6262b29
commit 28415f5ef2
4 changed files with 168 additions and 30 deletions

View File

@@ -4962,12 +4962,14 @@ var errNoAdvertisedAddr = errors.New("no advertised address found")
// fetchNodeAdvertisedAddrs attempts to fetch the advertised addresses of a node.
func (s *server) fetchNodeAdvertisedAddrs(pub *btcec.PublicKey) ([]net.Addr, error) {
ctx := context.TODO()
vertex, err := route.NewVertexFromBytes(pub.SerializeCompressed())
if err != nil {
return nil, err
}
node, err := s.graphDB.FetchLightningNode(vertex)
node, err := s.graphSource.FetchLightningNode(ctx, vertex)
if err != nil {
return nil, err
}