discovery/gossiper test: define unknown node announcement as stal

To mimic the current behaviour of the router's IsStaleNode, we make the
mockGraphSource consider a unknown node with no channels in the graph as
stale.
This commit is contained in:
Johan T. Halseth 2018-10-30 10:00:08 +01:00
parent 832bd8101c
commit 2911944e5a
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -206,7 +206,18 @@ func (r *mockGraphSource) IsStaleNode(nodePub routing.Vertex, timestamp time.Tim
}
}
return false
// If we did not find the node among our existing graph nodes, we
// require the node to already have a channel in the graph to not be
// considered stale.
for _, info := range r.infos {
if info.NodeKey1Bytes == nodePub {
return false
}
if info.NodeKey2Bytes == nodePub {
return false
}
}
return true
}
// IsPublicNode determines whether the given vertex is seen as a public node in