graph/db: version ChannelID lookup
Add a gossip version parameter to the ChannelID method (outpoint to short channel ID lookup) in the Store interface and both KV/SQL implementations. Update the VersionedGraph wrapper and tests.
This commit is contained in:
5 files changed
+26
-9
No files matched your search
+12
-4
@@ -177,8 +177,9 @@ func (c *ChannelGraph) populateCache(ctx context.Context) error {
|
||||
return nil
|
||||
}, func() {},
|
||||
)
|
||||
if err != nil &&
|
||||
!errors.Is(err, ErrVersionNotSupportedForKVDB) {
|
||||
if err != nil && !errors.Is(
|
||||
err, ErrVersionNotSupportedForKVDB,
|
||||
) {
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -685,8 +686,10 @@ func (c *ChannelGraph) AddEdgeProof(chanID lnwire.ShortChannelID,
|
||||
}
|
||||
|
||||
// ChannelID attempts to lookup the 8-byte compact channel ID.
|
||||
func (c *ChannelGraph) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
|
||||
return c.db.ChannelID(chanPoint)
|
||||
func (c *ChannelGraph) ChannelID(v lnwire.GossipVersion,
|
||||
chanPoint *wire.OutPoint) (uint64, error) {
|
||||
|
||||
return c.db.ChannelID(v, chanPoint)
|
||||
}
|
||||
|
||||
// HighestChanID returns the "highest" known channel ID in the channel graph.
|
||||
@@ -947,6 +950,11 @@ func (c *VersionedGraph) ForEachChannelCacheable(
|
||||
return c.db.ForEachChannelCacheable(c.v, cb, reset)
|
||||
}
|
||||
|
||||
// ChannelID attempts to lookup the 8-byte compact channel ID.
|
||||
func (c *VersionedGraph) ChannelID(chanPoint *wire.OutPoint) (uint64, error) {
|
||||
return c.db.ChannelID(c.v, chanPoint)
|
||||
}
|
||||
|
||||
// IsPublicNode determines whether the node is seen as public in the graph.
|
||||
func (c *VersionedGraph) IsPublicNode(pubKey [33]byte) (bool, error) {
|
||||
return c.db.IsPublicNode(c.v, pubKey)
|
||||
|
||||
Reference in new issue
Block a user