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
@@ -4005,7 +4005,13 @@ func (c *KVStore) FetchChannelEdgesByID(chanID uint64) (
|
||||
// IsPublicNode is a helper method that determines whether the node with the
|
||||
// given public key is seen as a public node in the graph from the graph's
|
||||
// source node's point of view.
|
||||
func (c *KVStore) IsPublicNode(pubKey [33]byte) (bool, error) {
|
||||
func (c *KVStore) IsPublicNode(v lnwire.GossipVersion, pubKey [33]byte) (bool,
|
||||
error) {
|
||||
|
||||
if v != lnwire.GossipVersion1 {
|
||||
return false, ErrVersionNotSupportedForKVDB
|
||||
}
|
||||
|
||||
var nodeIsPublic bool
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
nodes := tx.ReadBucket(nodeBucket)
|
||||
|
||||
Reference in new issue
Block a user