Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeHexColor(hex string) (color.RGBA, error)
- func DeserializeAddr(r io.Reader) (net.Addr, error)
- func DisableLog()
- func EncodeHexColor(color color.RGBA) string
- func ErrTooManyExtraOpaqueBytes(numBytes int) error
- func MigrateGraphToSQL(ctx context.Context, cfg *SQLStoreConfig, kvBackend kvdb.Backend, ...) error
- func ReadOutpoint(r io.Reader, o *wire.OutPoint) error
- func SerializeAddr(w io.Writer, address net.Addr) error
- func UseLogger(logger btclog.Logger)
- func WriteOutpoint(w io.Writer, o *wire.OutPoint) error
- type BatchedSQLQueries
- type KVStore
- func (c *KVStore) AddChannelEdge(_ context.Context, edge *models.ChannelEdgeInfo, _ ...batch.SchedulerOption) error
- func (c *KVStore) AddNode(_ context.Context, node *models.Node, _ ...batch.SchedulerOption) error
- func (c *KVStore) ForEachChannel(_ context.Context, ...) error
- func (c *KVStore) ForEachNode(_ context.Context, cb func(*models.Node) error, reset func()) error
- func (c *KVStore) MarkEdgeZombie(chanID uint64, pubKey1, pubKey2 [33]byte) error
- func (c *KVStore) PruneGraph(spentOutputs []*wire.OutPoint, blockHash *chainhash.Hash, blockHeight uint32) ([]*models.ChannelEdgeInfo, []route.Vertex, error)
- func (c *KVStore) PruneTip() (*chainhash.Hash, uint32, error)
- func (c *KVStore) PutClosedScid(scid lnwire.ShortChannelID) error
- func (c *KVStore) SetSourceNode(_ context.Context, node *models.Node) error
- func (c *KVStore) SourceNode(_ context.Context) (*models.Node, error)
- func (c *KVStore) UpdateEdgePolicy(_ context.Context, edge *models.ChannelEdgePolicy, _ ...batch.SchedulerOption) (route.Vertex, route.Vertex, error)
- type SQLQueries
- type SQLStore
- func (s *SQLStore) ForEachChannel(ctx context.Context, ...) error
- func (s *SQLStore) ForEachNode(ctx context.Context, cb func(node *models.Node) error, reset func()) error
- func (s *SQLStore) IsClosedScid(scid lnwire.ShortChannelID) (bool, error)
- func (s *SQLStore) IsZombieEdge(chanID uint64) (bool, [33]byte, [33]byte, error)
- func (s *SQLStore) PruneTip() (*chainhash.Hash, uint32, error)
- func (s *SQLStore) SourceNode(ctx context.Context) (*models.Node, error)
- type SQLStoreConfig
- type V1Store
Constants ¶
const ( // MaxAllowedExtraOpaqueBytes is the largest amount of opaque bytes that // we'll permit to be written to disk. We limit this as otherwise, it // would be possible for a node to create a ton of updates and slowly // fill our disk, and also waste bandwidth due to relaying. MaxAllowedExtraOpaqueBytes = 10000 )
const Subsystem = "GRDB"
Subsystem defines the logging code for this subsystem.
Variables ¶
var ( // ErrEdgePolicyOptionalFieldNotFound is an error returned if a channel // policy field is not found in the db even though its message flags // indicate it should be. ErrEdgePolicyOptionalFieldNotFound = fmt.Errorf("optional field not " + "present") // ErrParsingExtraTLVBytes is returned when we attempt to parse // extra opaque bytes as a TLV stream, but the parsing fails. ErrParsingExtraTLVBytes = fmt.Errorf("error parsing extra TLV bytes") // ErrGraphNotFound is returned when at least one of the components of // graph doesn't exist. ErrGraphNotFound = fmt.Errorf("graph bucket not initialized") // ErrGraphNeverPruned is returned when graph was never pruned. ErrGraphNeverPruned = fmt.Errorf("graph never pruned") // ErrSourceNodeNotSet is returned if the source node of the graph // hasn't been added The source node is the center node within a // star-graph. ErrSourceNodeNotSet = fmt.Errorf("source node does not exist") // ErrGraphNodesNotFound is returned in case none of the nodes has // been added in graph node bucket. ErrGraphNodesNotFound = fmt.Errorf("no graph nodes exist") // ErrGraphNoEdgesFound is returned in case of none of the channel/edges // has been added in graph edge bucket. ErrGraphNoEdgesFound = fmt.Errorf("no graph edges exist") // ErrGraphNodeNotFound is returned when we're unable to find the target // node. ErrGraphNodeNotFound = fmt.Errorf("unable to find node") // ErrZombieEdge is an error returned when we attempt to look up an edge // but it is marked as a zombie within the zombie index. ErrZombieEdge = errors.New("edge marked as zombie") // ErrEdgeNotFound is returned when an edge for the target chanID // can't be found. ErrEdgeNotFound = fmt.Errorf("edge not found") // ErrEdgeAlreadyExist is returned when edge with specific // channel id can't be added because it already exist. ErrEdgeAlreadyExist = fmt.Errorf("edge already exist") // ErrNodeAliasNotFound is returned when alias for node can't be found. ErrNodeAliasNotFound = fmt.Errorf("alias for node not found") // ErrClosedScidsNotFound is returned when the closed scid bucket // hasn't been created. ErrClosedScidsNotFound = fmt.Errorf("closed scid bucket doesn't exist") // ErrZombieEdgeNotFound is an error returned when we attempt to find an // edge in the zombie index which is not there. ErrZombieEdgeNotFound = errors.New("edge not found in zombie index") // ErrUnknownAddressType is returned when a node's addressType is not // an expected value. ErrUnknownAddressType = fmt.Errorf("address type cannot be resolved") // ErrCantCheckIfZombieEdgeStr is an error returned when we // attempt to check if an edge is a zombie but encounter an error. ErrCantCheckIfZombieEdgeStr = fmt.Errorf("unable to check if edge " + "is a zombie") )
Functions ¶
func DecodeHexColor ¶
DecodeHexColor takes a hex color string like "#rrggbb" and returns a color.RGBA.
func DeserializeAddr ¶
DeserializeAddr reads the serialized raw representation of an address and deserializes it into the actual address. This allows us to avoid address resolution within the channeldb package.
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
func EncodeHexColor ¶
EncodeHexColor takes a color and returns it in hex code format.
func ErrTooManyExtraOpaqueBytes ¶
ErrTooManyExtraOpaqueBytes creates an error which should be returned if the caller attempts to write an announcement message which bares too many extra opaque bytes. We limit this value in order to ensure that we don't waste disk space due to nodes unnecessarily padding out their announcements with garbage data.
func MigrateGraphToSQL ¶
func MigrateGraphToSQL(ctx context.Context, cfg *SQLStoreConfig, kvBackend kvdb.Backend, sqlDB SQLQueries) error
MigrateGraphToSQL migrates the graph store from a KV backend to a SQL backend.
NOTE: this is currently not called from any code path. It is called via tests only for now and will be called from the main lnd binary once the migration is fully implemented and tested.
func ReadOutpoint ¶
ReadOutpoint reads an outpoint from the passed reader that was previously written using the WriteOutpoint struct.
func SerializeAddr ¶
SerializeAddr serializes an address into its raw bytes representation so that it can be deserialized without requiring address resolution.
Types ¶
type BatchedSQLQueries ¶
type BatchedSQLQueries interface {
SQLQueries
sqldb.BatchedTx[SQLQueries]
}
BatchedSQLQueries is a version of SQLQueries that's capable of batched database operations.
type KVStore ¶
type KVStore struct {
// contains filtered or unexported fields
}
KVStore is a persistent, on-disk graph representation of the Lightning Network. This struct can be used to implement path finding algorithms on top of, and also to update a node's view based on information received from the p2p network. Internally, the graph is stored using a modified adjacency list representation with some added object interaction possible with each serialized edge/node. The graph is stored is directed, meaning that are two edges stored for each channel: an inbound/outbound edge for each node pair. Nodes, edges, and edge information can all be added to the graph independently. Edge removal results in the deletion of all edge information for that edge.
func NewKVStore ¶
NewKVStore allocates a new KVStore backed by a DB instance. The returned instance has its own unique reject cache and channel cache.
func (*KVStore) AddChannelEdge ¶
func (c *KVStore) AddChannelEdge(_ context.Context, edge *models.ChannelEdgeInfo, _ ...batch.SchedulerOption) error
AddChannelEdge adds a new (undirected, blank) edge to the graph database. An undirected edge from the two target nodes are created. The information stored denotes the static attributes of the channel, such as the channelID, the keys involved in creation of the channel, and the set of features that the channel supports. The chanPoint and chanID are used to uniquely identify the edge globally within the database.
func (*KVStore) AddNode ¶
AddNode adds a vertex/node to the graph database. If the node is not in the database from before, this will add a new, unconnected one to the graph. If it is present from before, this will update that node's information. Note that this method is expected to only be called to update an already present node from a node announcement, or to insert a node found in a channel update.
TODO(roasbeef): also need sig of announcement.
func (*KVStore) ForEachChannel ¶
func (c *KVStore) ForEachChannel(_ context.Context, cb func(*models.ChannelEdgeInfo, *models.ChannelEdgePolicy, *models.ChannelEdgePolicy) error, reset func()) error
ForEachChannel iterates through all the channel edges stored within the graph and invokes the passed callback for each edge. The callback takes two edges as since this is a directed graph, both the in/out edges are visited. If the callback returns an error, then the transaction is aborted and the iteration stops early.
NOTE: If an edge can't be found, or wasn't advertised, then a nil pointer for that particular channel edge routing policy will be passed into the callback.
func (*KVStore) ForEachNode ¶
ForEachNode iterates through all the stored vertices/nodes in the graph, executing the passed callback with each node encountered. If the callback returns an error, then the transaction is aborted and the iteration stops early.
NOTE: this is part of the V1Store interface.
func (*KVStore) MarkEdgeZombie ¶
MarkEdgeZombie attempts to mark a channel identified by its channel ID as a zombie. This method is used on an ad-hoc basis, when channels need to be marked as zombies outside the normal pruning cycle.
func (*KVStore) PruneGraph ¶
func (c *KVStore) PruneGraph(spentOutputs []*wire.OutPoint, blockHash *chainhash.Hash, blockHeight uint32) ( []*models.ChannelEdgeInfo, []route.Vertex, error)
PruneGraph prunes newly closed channels from the channel graph in response to a new block being solved on the network. Any transactions which spend the funding output of any known channels within he graph will be deleted. Additionally, the "prune tip", or the last block which has been used to prune the graph is stored so callers can ensure the graph is fully in sync with the current UTXO state. A slice of channels that have been closed by the target block along with any pruned nodes are returned if the function succeeds without error.
func (*KVStore) PruneTip ¶
PruneTip returns the block height and hash of the latest block that has been used to prune channels in the graph. Knowing the "prune tip" allows callers to tell if the graph is currently in sync with the current best known UTXO state.
func (*KVStore) PutClosedScid ¶
func (c *KVStore) PutClosedScid(scid lnwire.ShortChannelID) error
PutClosedScid stores a SCID for a closed channel in the database. This is so that we can ignore channel announcements that we know to be closed without having to validate them and fetch a block.
func (*KVStore) SetSourceNode ¶
SetSourceNode sets the source node within the graph database. The source node is to be used as the center of a star-graph within path finding algorithms.
func (*KVStore) SourceNode ¶
SourceNode returns the source node of the graph. The source node is treated as the center node within a star-graph. This method may be used to kick off a path finding algorithm in order to explore the reachability of another node based off the source node.
func (*KVStore) UpdateEdgePolicy ¶
func (c *KVStore) UpdateEdgePolicy(_ context.Context, edge *models.ChannelEdgePolicy, _ ...batch.SchedulerOption) (route.Vertex, route.Vertex, error)
UpdateEdgePolicy updates the edge routing policy for a single directed edge within the database for the referenced channel. The `flags` attribute within the ChannelEdgePolicy determines which of the directed edges are being updated. If the flag is 1, then the first node's information is being updated, otherwise it's the second node's information. The node ordering is determined by the lexicographical ordering of the identity public keys of the nodes on either side of the channel.
type SQLQueries ¶
type SQLQueries interface {
/*
Node queries.
*/
UpsertNode(ctx context.Context, arg sqlc.UpsertNodeParams) (int64, error)
GetNodeByPubKey(ctx context.Context, arg sqlc.GetNodeByPubKeyParams) (sqlc.GraphNode, error)
GetNodesByIDs(ctx context.Context, ids []int64) ([]sqlc.GraphNode, error)
GetNodeIDByPubKey(ctx context.Context, arg sqlc.GetNodeIDByPubKeyParams) (int64, error)
GetNodesByLastUpdateRange(ctx context.Context, arg sqlc.GetNodesByLastUpdateRangeParams) ([]sqlc.GraphNode, error)
ListNodesPaginated(ctx context.Context, arg sqlc.ListNodesPaginatedParams) ([]sqlc.GraphNode, error)
ListNodeIDsAndPubKeys(ctx context.Context, arg sqlc.ListNodeIDsAndPubKeysParams) ([]sqlc.ListNodeIDsAndPubKeysRow, error)
DeleteUnconnectedNodes(ctx context.Context) ([][]byte, error)
DeleteNodeByPubKey(ctx context.Context, arg sqlc.DeleteNodeByPubKeyParams) (sql.Result, error)
DeleteNode(ctx context.Context, id int64) error
GetExtraNodeTypes(ctx context.Context, nodeID int64) ([]sqlc.GraphNodeExtraType, error)
GetNodeExtraTypesBatch(ctx context.Context, ids []int64) ([]sqlc.GraphNodeExtraType, error)
UpsertNodeExtraType(ctx context.Context, arg sqlc.UpsertNodeExtraTypeParams) error
DeleteExtraNodeType(ctx context.Context, arg sqlc.DeleteExtraNodeTypeParams) error
UpsertNodeAddress(ctx context.Context, arg sqlc.UpsertNodeAddressParams) error
GetNodeAddresses(ctx context.Context, nodeID int64) ([]sqlc.GetNodeAddressesRow, error)
GetNodeAddressesBatch(ctx context.Context, ids []int64) ([]sqlc.GraphNodeAddress, error)
DeleteNodeAddresses(ctx context.Context, nodeID int64) error
InsertNodeFeature(ctx context.Context, arg sqlc.InsertNodeFeatureParams) error
GetNodeFeaturesBatch(ctx context.Context, ids []int64) ([]sqlc.GraphNodeFeature, error)
GetNodeFeaturesByPubKey(ctx context.Context, arg sqlc.GetNodeFeaturesByPubKeyParams) ([]int32, error)
DeleteNodeFeature(ctx context.Context, arg sqlc.DeleteNodeFeatureParams) error
/*
Source node queries.
*/
AddSourceNode(ctx context.Context, nodeID int64) error
GetSourceNodesByVersion(ctx context.Context, version int16) ([]sqlc.GetSourceNodesByVersionRow, error)
/*
Channel queries.
*/
CreateChannel(ctx context.Context, arg sqlc.CreateChannelParams) (int64, error)
AddV1ChannelProof(ctx context.Context, arg sqlc.AddV1ChannelProofParams) (sql.Result, error)
GetChannelBySCID(ctx context.Context, arg sqlc.GetChannelBySCIDParams) (sqlc.GraphChannel, error)
GetChannelsBySCIDs(ctx context.Context, arg sqlc.GetChannelsBySCIDsParams) ([]sqlc.GraphChannel, error)
GetChannelsByOutpoints(ctx context.Context, outpoints []string) ([]sqlc.GetChannelsByOutpointsRow, error)
GetChannelsBySCIDRange(ctx context.Context, arg sqlc.GetChannelsBySCIDRangeParams) ([]sqlc.GetChannelsBySCIDRangeRow, error)
GetChannelBySCIDWithPolicies(ctx context.Context, arg sqlc.GetChannelBySCIDWithPoliciesParams) (sqlc.GetChannelBySCIDWithPoliciesRow, error)
GetChannelsBySCIDWithPolicies(ctx context.Context, arg sqlc.GetChannelsBySCIDWithPoliciesParams) ([]sqlc.GetChannelsBySCIDWithPoliciesRow, error)
GetChannelsByIDs(ctx context.Context, ids []int64) ([]sqlc.GetChannelsByIDsRow, error)
GetChannelAndNodesBySCID(ctx context.Context, arg sqlc.GetChannelAndNodesBySCIDParams) (sqlc.GetChannelAndNodesBySCIDRow, error)
HighestSCID(ctx context.Context, version int16) ([]byte, error)
ListChannelsByNodeID(ctx context.Context, arg sqlc.ListChannelsByNodeIDParams) ([]sqlc.ListChannelsByNodeIDRow, error)
ListChannelsForNodeIDs(ctx context.Context, arg sqlc.ListChannelsForNodeIDsParams) ([]sqlc.ListChannelsForNodeIDsRow, error)
ListChannelsWithPoliciesPaginated(ctx context.Context, arg sqlc.ListChannelsWithPoliciesPaginatedParams) ([]sqlc.ListChannelsWithPoliciesPaginatedRow, error)
ListChannelsPaginated(ctx context.Context, arg sqlc.ListChannelsPaginatedParams) ([]sqlc.ListChannelsPaginatedRow, error)
GetChannelsByPolicyLastUpdateRange(ctx context.Context, arg sqlc.GetChannelsByPolicyLastUpdateRangeParams) ([]sqlc.GetChannelsByPolicyLastUpdateRangeRow, error)
GetChannelByOutpointWithPolicies(ctx context.Context, arg sqlc.GetChannelByOutpointWithPoliciesParams) (sqlc.GetChannelByOutpointWithPoliciesRow, error)
GetPublicV1ChannelsBySCID(ctx context.Context, arg sqlc.GetPublicV1ChannelsBySCIDParams) ([]sqlc.GraphChannel, error)
GetSCIDByOutpoint(ctx context.Context, arg sqlc.GetSCIDByOutpointParams) ([]byte, error)
DeleteChannels(ctx context.Context, ids []int64) error
UpsertChannelExtraType(ctx context.Context, arg sqlc.UpsertChannelExtraTypeParams) error
GetChannelExtrasBatch(ctx context.Context, chanIds []int64) ([]sqlc.GraphChannelExtraType, error)
InsertChannelFeature(ctx context.Context, arg sqlc.InsertChannelFeatureParams) error
GetChannelFeaturesBatch(ctx context.Context, chanIds []int64) ([]sqlc.GraphChannelFeature, error)
/*
Channel Policy table queries.
*/
UpsertEdgePolicy(ctx context.Context, arg sqlc.UpsertEdgePolicyParams) (int64, error)
GetChannelPolicyByChannelAndNode(ctx context.Context, arg sqlc.GetChannelPolicyByChannelAndNodeParams) (sqlc.GraphChannelPolicy, error)
GetV1DisabledSCIDs(ctx context.Context) ([][]byte, error)
UpsertChanPolicyExtraType(ctx context.Context, arg sqlc.UpsertChanPolicyExtraTypeParams) error
GetChannelPolicyExtraTypesBatch(ctx context.Context, policyIds []int64) ([]sqlc.GetChannelPolicyExtraTypesBatchRow, error)
DeleteChannelPolicyExtraTypes(ctx context.Context, channelPolicyID int64) error
/*
Zombie index queries.
*/
UpsertZombieChannel(ctx context.Context, arg sqlc.UpsertZombieChannelParams) error
GetZombieChannel(ctx context.Context, arg sqlc.GetZombieChannelParams) (sqlc.GraphZombieChannel, error)
GetZombieChannelsSCIDs(ctx context.Context, arg sqlc.GetZombieChannelsSCIDsParams) ([]sqlc.GraphZombieChannel, error)
CountZombieChannels(ctx context.Context, version int16) (int64, error)
DeleteZombieChannel(ctx context.Context, arg sqlc.DeleteZombieChannelParams) (sql.Result, error)
IsZombieChannel(ctx context.Context, arg sqlc.IsZombieChannelParams) (bool, error)
/*
Prune log table queries.
*/
GetPruneTip(ctx context.Context) (sqlc.GraphPruneLog, error)
GetPruneHashByHeight(ctx context.Context, blockHeight int64) ([]byte, error)
GetPruneEntriesForHeights(ctx context.Context, heights []int64) ([]sqlc.GraphPruneLog, error)
UpsertPruneLogEntry(ctx context.Context, arg sqlc.UpsertPruneLogEntryParams) error
DeletePruneLogEntriesInRange(ctx context.Context, arg sqlc.DeletePruneLogEntriesInRangeParams) error
/*
Closed SCID table queries.
*/
InsertClosedChannel(ctx context.Context, scid []byte) error
IsClosedChannel(ctx context.Context, scid []byte) (bool, error)
GetClosedChannelsSCIDs(ctx context.Context, scids [][]byte) ([][]byte, error)
/*
Migration specific queries.
NOTE: these should not be used in code other than migrations.
Once sqldbv2 is in place, these can be removed from this struct
as then migrations will have their own dedicated queries
structs.
*/
InsertNodeMig(ctx context.Context, arg sqlc.InsertNodeMigParams) (int64, error)
InsertChannelMig(ctx context.Context, arg sqlc.InsertChannelMigParams) (int64, error)
InsertEdgePolicyMig(ctx context.Context, arg sqlc.InsertEdgePolicyMigParams) (int64, error)
}
SQLQueries is a subset of the sqlc.Querier interface that can be used to execute queries against the SQL graph tables.
type SQLStore ¶
type SQLStore struct {
// contains filtered or unexported fields
}
SQLStore is an implementation of the V1Store interface that uses a SQL database as the backend.
func NewSQLStore ¶
func NewSQLStore(cfg *SQLStoreConfig, db BatchedSQLQueries) (*SQLStore, error)
NewSQLStore creates a new SQLStore instance given an open BatchedSQLQueries storage backend.
func (*SQLStore) ForEachChannel ¶
func (s *SQLStore) ForEachChannel(ctx context.Context, cb func(*models.ChannelEdgeInfo, *models.ChannelEdgePolicy, *models.ChannelEdgePolicy) error, reset func()) error
ForEachChannel iterates through all the channel edges stored within the graph and invokes the passed callback for each edge. The callback takes two edges as since this is a directed graph, both the in/out edges are visited. If the callback returns an error, then the transaction is aborted and the iteration stops early.
NOTE: If an edge can't be found, or wasn't advertised, then a nil pointer for that particular channel edge routing policy will be passed into the callback.
NOTE: part of the V1Store interface.
func (*SQLStore) ForEachNode ¶
func (s *SQLStore) ForEachNode(ctx context.Context, cb func(node *models.Node) error, reset func()) error
ForEachNode iterates through all the stored vertices/nodes in the graph, executing the passed callback with each node encountered. If the callback returns an error, then the transaction is aborted and the iteration stops early.
NOTE: part of the V1Store interface.
func (*SQLStore) IsClosedScid ¶
func (s *SQLStore) IsClosedScid(scid lnwire.ShortChannelID) (bool, error)
IsClosedScid checks whether a channel identified by the passed in scid is closed. This helps avoid having to perform expensive validation checks.
NOTE: part of the V1Store interface.
func (*SQLStore) IsZombieEdge ¶
IsZombieEdge returns whether the edge is considered zombie. If it is a zombie, then the two node public keys corresponding to this edge are also returned.
NOTE: part of the V1Store interface.
func (*SQLStore) PruneTip ¶
PruneTip returns the block height and hash of the latest block that has been used to prune channels in the graph. Knowing the "prune tip" allows callers to tell if the graph is currently in sync with the current best known UTXO state.
NOTE: part of the V1Store interface.
func (*SQLStore) SourceNode ¶
SourceNode returns the source node of the graph. The source node is treated as the center node within a star-graph. This method may be used to kick off a path finding algorithm in order to explore the reachability of another node based off the source node.
NOTE: part of the V1Store interface.
type SQLStoreConfig ¶
type SQLStoreConfig struct {
// ChainHash is the genesis hash for the chain that all the gossip
// messages in this store are aimed at.
ChainHash chainhash.Hash
// QueryConfig holds configuration values for SQL queries.
QueryCfg *sqldb.QueryConfig
}
SQLStoreConfig holds the configuration for the SQLStore.
type V1Store ¶
type V1Store interface {
// ForEachNode iterates through all the stored vertices/nodes in the
// graph, executing the passed callback with each node encountered. If
// the callback returns an error, then the transaction is aborted and
// the iteration stops early.
ForEachNode(ctx context.Context, cb func(*models.Node) error,
reset func()) error
// ForEachChannel iterates through all the channel edges stored within
// the graph and invokes the passed callback for each edge. The callback
// takes two edges as since this is a directed graph, both the in/out
// edges are visited. If the callback returns an error, then the
// transaction is aborted and the iteration stops early.
//
// NOTE: If an edge can't be found, or wasn't advertised, then a nil
// pointer for that particular channel edge routing policy will be
// passed into the callback.
ForEachChannel(ctx context.Context, cb func(*models.ChannelEdgeInfo,
*models.ChannelEdgePolicy, *models.ChannelEdgePolicy) error,
reset func()) error
// SourceNode returns the source node of the graph. The source node is
// treated as the center node within a star-graph. This method may be
// used to kick off a path finding algorithm in order to explore the
// reachability of another node based off the source node.
SourceNode(ctx context.Context) (*models.Node, error)
}
V1Store represents the main interface for the channel graph database for all channels and nodes gossiped via the V1 gossip protocol as defined in BOLT 7.