netann+lnd: add netann.ChannelGraph to the GraphSource interface

And let DBSource implement it.
This commit is contained in:
Elle Mouton
2024-11-11 16:48:58 +02:00
parent 6f3d45f5d9
commit 237151d9df
7 changed files with 30 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/btcsuite/btcd/wire"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/graph/db/models"
"github.com/lightningnetwork/lnd/graph/session"
@@ -105,6 +106,17 @@ func (s *DBSource) IsPublicNode(_ context.Context,
return s.db.IsPublicNode(pubKey)
}
// FetchChannelEdgesByOutpoint returns the channel edge info and most recent
// channel edge policies for a given outpoint.
//
// NOTE: this is part of the netann.ChannelGraph interface.
func (s *DBSource) FetchChannelEdgesByOutpoint(_ context.Context,
point *wire.OutPoint) (*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy, *models.ChannelEdgePolicy, error) {
return s.db.FetchChannelEdgesByOutpoint(point)
}
// kvdbRTx is an implementation of graphdb.RTx backed by a KVDB database read
// transaction.
type kvdbRTx struct {