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

@@ -1009,7 +1009,7 @@ type routingMsg struct {
// pruneNodeFromRoutes accepts set of routes, and returns a new set of routes
// with the target node filtered out.
func pruneNodeFromRoutes(routes []*Route, skipNode vertex) []*Route {
func pruneNodeFromRoutes(routes []*Route, skipNode Vertex) []*Route {
// TODO(roasbeef): pass in slice index?
@@ -1130,7 +1130,7 @@ func (r *ChannelRouter) FindRoutes(target *btcec.PublicKey,
// aren't able to support the total satoshis flow once fees have been
// factored in.
validRoutes := make([]*Route, 0, len(shortestPaths))
sourceVertex := newVertex(r.selfNode.PubKey)
sourceVertex := NewVertex(r.selfNode.PubKey)
for _, path := range shortestPaths {
// Attempt to make the path into a route. We snip off the first
// hop in the path as it contains a "self-hop" that is inserted