graph/db: add version parameter to IsPublicNode
Make IsPublicNode version-aware by routing to the appropriate SQL query based on gossip version. V1 and v2 have different criteria for determining node publicity (v1 requires four signatures, v2 requires one). Convert TestNodeIsPublic to versioned test for both protocols.
This commit is contained in:
6 files changed
+46
-24
No files matched your search
+6
-1
@@ -637,7 +637,7 @@ func (c *ChannelGraph) HasV1Node(ctx context.Context,
|
||||
|
||||
// IsPublicNode determines whether the node is seen as public in the graph.
|
||||
func (c *ChannelGraph) IsPublicNode(pubKey [33]byte) (bool, error) {
|
||||
return c.db.IsPublicNode(pubKey)
|
||||
return c.db.IsPublicNode(lnwire.GossipVersion1, pubKey)
|
||||
}
|
||||
|
||||
// ForEachChannel iterates through all channel edges stored within the graph.
|
||||
@@ -861,6 +861,11 @@ func (c *VersionedGraph) DeleteChannelEdges(strictZombiePruning,
|
||||
return err
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// MakeTestGraph creates a new instance of the ChannelGraph for testing
|
||||
// purposes. The backing Store implementation depends on the version of
|
||||
// NewTestDB included in the current build.
|
||||
|
||||
Reference in new issue
Block a user