discovery+routing: add FetchLightningNode to ChannelGraphSource interface

This commit is contained in:
Wilmer Paulino committed 2018-11-11 17:48:05 -08:00
1 parent d4b042dc19
commit 4f45e339f1
2 files changed
+30

No files matched your search

+12
View File
@@ -196,6 +196,18 @@ func (r *mockGraphSource) GetChannelByID(chanID lnwire.ShortChannelID) (
return chanInfo, edges[0], edges[1], nil
}
func (r *mockGraphSource) FetchLightningNode(
nodePub routing.Vertex) (*channeldb.LightningNode, error) {
for _, node := range r.nodes {
if bytes.Equal(nodePub[:], node.PubKeyBytes[:]) {
return node, nil
}
}
return nil, channeldb.ErrGraphNodeNotFound
}
// IsStaleNode returns true if the graph source has a node announcement for the
// target node with a more recent timestamp.
func (r *mockGraphSource) IsStaleNode(nodePub routing.Vertex, timestamp time.Time) bool {