From 2911944e5a426d2f991353a14cfb7272e253216f Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 30 Oct 2018 10:00:08 +0100 Subject: [PATCH] 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. --- discovery/gossiper_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/discovery/gossiper_test.go b/discovery/gossiper_test.go index d9499a4a3..96c3714fa 100644 --- a/discovery/gossiper_test.go +++ b/discovery/gossiper_test.go @@ -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