discovery: create deDupedAnnouncements struct in gosspier.go

For Part 1 of Issue #275. Create isolated private struct in
networkHandler goroutine that will de-duplicate
announcements added to the batch. The struct contains maps
for each of channel announcements, channel updates, and
node announcements to keep track of unique announcements.

The struct has a Reset method to reset stored announcements, an
AddMsg(lnwire.Message) method to add a new message to the current
batch, and a Batch method to return the set of de-duplicated
announcements.

Also fix a few minor typos.
This commit is contained in:
Laura Cressman
2017-09-07 21:25:43 -04:00
committed by Olaoluwa Osuntokun
parent 1f95b660b9
commit 39d38da732
7 changed files with 173 additions and 70 deletions

View File

@@ -303,7 +303,7 @@ func TestBasicGraphPathFinding(t *testing.T) {
sourceVertex := newVertex(sourceNode.PubKey)
ignoredEdges := make(map[uint64]struct{})
ignoredVertexes := make(map[vertex]struct{})
ignoredVertexes := make(map[Vertex]struct{})
// With the test graph loaded, we'll test some basic path finding using
// the pre-generated graph. Consult the testdata/basic_graph.json file
@@ -527,7 +527,7 @@ func TestNewRoutePathTooLong(t *testing.T) {
}
ignoredEdges := make(map[uint64]struct{})
ignoredVertexes := make(map[vertex]struct{})
ignoredVertexes := make(map[Vertex]struct{})
paymentAmt := lnwire.NewMSatFromSatoshis(100)
@@ -568,7 +568,7 @@ func TestPathNotAvailable(t *testing.T) {
}
ignoredEdges := make(map[uint64]struct{})
ignoredVertexes := make(map[vertex]struct{})
ignoredVertexes := make(map[Vertex]struct{})
// With the test graph loaded, we'll test that queries for target that
// are either unreachable within the graph, or unknown result in an
@@ -604,7 +604,7 @@ func TestPathInsufficientCapacity(t *testing.T) {
t.Fatalf("unable to fetch source node: %v", err)
}
ignoredEdges := make(map[uint64]struct{})
ignoredVertexes := make(map[vertex]struct{})
ignoredVertexes := make(map[Vertex]struct{})
// Next, test that attempting to find a path in which the current
// channel graph cannot support due to insufficient capacity triggers