Commit Graph

124 Commits

Author SHA1 Message Date
Johan T. Halseth
10b838e9b4 gossiper: private channel cleanup + comments
This commit adds some comments and does some cleanup
of the logic that makes sure non-public channels
(channels with no AuthProof) are not broadcasted
to the network.
2017-12-17 18:35:34 -08:00
nsa
dab7f31e44 gossiper: Only send channel updates for edges with AuthProof. 2017-12-17 18:35:34 -08:00
Olaoluwa Osuntokun
37c54153fa
discovery: properly set node's color when syncing graph state
This commit fixes an existing bug wherein we would blank out a node’s
color instead of properly setting the field when syncing graph state
with another node This would cause the node to reject the node
announcement and we would generate an we would invalidate the signature
of the node announcement. We fix this simply by properly setting the
node announcement.
2017-12-02 18:33:21 -08:00
Olaoluwa Osuntokun
ee7c3ff01c
discovery: properly set node's color field when adding NodeAnnouncement to router
In this commit, we fix an existing bug when processing new node
announcement. Before this commit, we wouldn’t also copy over the color
field of a node’s announcement. As a result, when went to synchronize
our graph state with that of a connecting peer, we would generate an
invalid node announcement. We fix this by properly setting the color
field of a node.
2017-12-02 18:28:41 -08:00
Olaoluwa Osuntokun
3802cb90df
discovery: publicly export announcement validation related functions 2017-12-01 19:31:54 -08:00
Olaoluwa Osuntokun
12a0488bc6
discovery: use lnwire.ChanUpdateFlag masks when examinig ChannelUpdate msgs
In this commit, we now properly examine the Flag field within the
ChannelUpdate message as a bitfield. Before this commit we would
manually check the flags for zero or one. This was incorrect as a their
bit has now been defined. To properly dispatch the messages, we’ll now
treat it properly as a bitmask.
2017-11-30 22:37:21 -08:00
Olaoluwa Osuntokun
c0b8c29382
discovery: continue in loop after processing announcement signatures 2017-11-29 18:35:19 -08:00
Olaoluwa Osuntokun
4ab16b5c91
discovery: process AnnouncementSignatures msgs serially 2017-11-29 17:53:21 -08:00
Olaoluwa Osuntokun
3067d05ae8
discovery: validate incoming announcements in parallel 2017-11-29 16:45:14 -08:00
Olaoluwa Osuntokun
2dcd2b8a6d
discovery: add a mutex in order to make deDupedAnnouncements thread-safe 2017-11-29 16:21:16 -08:00
Laura Cressman
ed6ad22e85 config+server+networktest: make trickleDelay configurable
Add option to set trickleDelay for AuthenticatedGossiper in
command line, with default value of 300 milliseconds. Pass this
value to newServer, which uses it when creating a new instance of
AuthenticatedGossiper. Also set this value to 300 milliseconds when
creating nodes in integration tests.
2017-11-15 16:50:19 -08:00
Laura Cressman
39d38da732 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.
2017-11-15 16:50:19 -08:00
Olaoluwa Osuntokun
8c181b6f4e
discovery: return an error if ChannelUpdate has unknown flags
In this commit, we fix an existing bug that could result in a panic if
we received a ChannelUpdate message with an unknown set of flags. If
the flag wasn’t set to zero or one, then the pubKey parameter would be
still nil when we attempted to validate it, causing an error to occur.

We remedy this by instead returning an error if the flags are unknown.
In a future commit, we will properly handle the set of flags that
indicates the channel should be disabled.
2017-11-11 14:59:16 -08:00
Conner Fromknecht
3b2e4caa93 discovery/gossiper: isolate sync with node from query
This commit refactors the SynchronizeNode logic such that
  it can be called without interacting with the gossiper's
  main execution loop. This method does not require access
  to any of the gossiper's internal state, making the change
  fairly straightforward. The primary motivation behind
  this change is to minimize the possibility of introducing
  deadlock scenarios between the gossiper and server.
2017-10-27 15:48:37 -07:00
Jim Posen
9fd77a6e40 multi: Update lnd to use new feature vector API. 2017-10-17 22:47:20 -07:00
Olaoluwa Osuntokun
03f9479eb4
discovery: only interpret remote announcements as pre-mature
This commit fixes a slight bug in the announcement processing logic
within the AuthenticatedGossiper. Before this commit, it was possible
for us to ignore one of our now announcements due to it being
pre-mature, rendering (atm) the channel unusable by the ChannelRouter
itself. To fix this, we know only check for a pre mature announcement
iff the message is coming from a remote node.
2017-10-17 19:44:13 -07:00
Olaoluwa Osuntokun
490e0d0f46
discovery: broadcast OG chan ann in retransmitStaleChannels 2017-10-04 20:46:12 -07:00
Olaoluwa Osuntokun
0d28bb14cb
discovery: also return latest ChannelAnnouncement from updateChannel
This commit adds an additional return value to the updateChannel
method. We also now return the original ChannelAnnouncement, this can
be useful as it let’s the caller ensure that the channel announcement
will be broadcast along side the new channel update.
2017-10-04 20:46:10 -07:00
Olaoluwa Osuntokun
4be2e95a78
discovery: fix boltdb deadlock bug in ann retrans, retrans at start
This commit does two things. First we fix a deadlock bug within boltdb
that could arise when the channel router attempted to open a
transaction, while the retransmission loop was attempting to send a
message to the channel router (circular wait). Second, we’ve refactored
out the retransmission into its own function. This allows us to kick
off retransmission as soon as the AuthenticatedGossiper is created.
2017-10-04 20:46:10 -07:00
Olaoluwa Osuntokun
81cd954cfc
discovery: don't prune *our* channels during retransmission tick
This commit modifies the recently modified logic for self-channel
retransmission to exclude pruning *our* channels which haven’t been
updated since the broadcastInterval. Instead, we only re-broadcast
channels of ours that haven’t been updated in 24 hours.
2017-10-04 20:46:08 -07:00
Brandon
3907ae65c2 routing+discovery: implement 2-week network view pruning 2017-10-04 20:40:21 -07:00
Olaoluwa Osuntokun
c529597ff9
discovery: add more detail to error logging in processNetworkAnnouncement 2017-09-12 17:12:22 +02:00
Olaoluwa Osuntokun
0b4ff2aabb
discovery: ignore any incoming channel ann's for an unknown chain
This commit fixes an existing bug in the announcement processing of the
authenticated gossiper. We will now only examine an incoming
announcement for validity if it targets the chain that we’re currently
active on.
2017-09-03 16:41:09 -07:00
Olaoluwa Osuntokun
1e513875e5
discovery: rename service.go to gossiper.go 2017-09-03 16:21:10 -07:00