Commit Graph

476 Commits

Author SHA1 Message Date
Carla Kirk-Cohen
3f9f0ea5d1
multi/refactor: separate methods for get and set node announcement
In preparation for a more complex function signature for set node
announcement, separate get and set so that readonly callers don't need
to handle the extra arguments.
2023-05-04 10:35:42 -04:00
yyforyongyu
2b8e9a0d36
multi: add more trace logs regarding link activate flow 2023-03-21 10:18:49 +07:00
yyforyongyu
f22b25a1bf
discovery+server: add more trace log 2023-03-08 21:02:53 +08:00
yyforyongyu
9bc7f0fb21
discovery: make futureMsgs into a struct and test
This commit adds a simple struct `futureMsgCache` that embeds a lru
cache with the message ID. A unit test is added to check the eviction
behaves as expected.
2023-03-03 15:35:08 +08:00
yyforyongyu
78a983c014
discovery: flatten future message cache
This commit removes the slice used when saving future messages into the
cache. Instead, each message is now saved independently into the cache
with a monotonically increasing integer as its ID.
2023-03-03 14:43:06 +08:00
yyforyongyu
a6abb3c960
discovery: increase allowed max future message size
This commit adds a new const to increase the max future messages allowed
from 100 to 1000, which is needed as during IBD a node with lots of
channels might receive many future messages.
2023-03-03 14:24:13 +08:00
Olaoluwa Osuntokun
9f1daf31c1
Merge pull request #7445 from yyforyongyu/fix-heap
discovery: fix heap escape on `cachedMsgs`
2023-02-23 16:24:22 -08:00
yyforyongyu
ce1d1c6248
discovery: fix heap escape on cachedMsgs 2023-02-23 23:18:05 +08:00
yyforyongyu
2ddf079889
discovery+server.go: add FindChannel to fix itest flake 2023-02-23 21:56:13 +08:00
Olaoluwa Osuntokun
d793a53bba
Merge pull request #7406 from Roasbeef/gossip-cache-fix
multi: bump neutrino+btcwallet versions, use new generic lru cache
2023-02-22 15:49:49 -08:00
Oliver Gugger
b3e27f9ba7
Merge pull request #7415 from bitromortac/2302-max-htlc
routing+discovery: fail non-maxHTLC channel updates in validation
2023-02-22 08:45:56 +01:00
Olaoluwa Osuntokun
a15c45231e
multi: bump neutrino+btcwallet versions, use new generic lru cache 2023-02-21 17:28:48 -08:00
bitromortac
6459385dfd
discovery: skip non-maxHTLC updates in gossip sync
We skip syncing channel updates that don't conform to the spec.
2023-02-21 14:03:51 +01:00
bitromortac
6aac2762b3
routing: stricter maxHTLC checks
We require channel updates to have the max HTLC message flag set.

Several flows need to pass that check before channel updates are
forwarded to peers:
* after channel funding: `addToRouterGraph`
* after receiving channel updates from a peer:
  `ProcessRemoteAnnouncement`
* after we update channel policies: `PropagateChanPolicyUpdate`
2023-02-21 14:03:51 +01:00
bitromortac
dd5273c88c
multi: rename due to required maxHTLC bit
We rename `ChanUpdateOptionMaxHtlc` to `ChanUpdateRequiredMaxHtlc`
as with the latest changes it is now required.

Similarly, rename `validateOptionalFields` to
`ValidateChannelUpdateFields`, export it to use it in a later commit.
2023-02-21 11:10:39 +01:00
yyforyongyu
e34a088608
discovery: send both local and remote anns in the same goroutine
This commit changes the sending of anns from using separate goroutines
to always sending both local and remote announcements in the same
goroutine. In addition, the local announcements are always sent first.
This change is to fix the following case:

1. Alice and Bob have a channel
2. Alice receives Bob's NodeAnnouncement
3. Alice goes to broadcast the channel
4. The broadcast is split into a local and remote broadcast due to PR
   #7239. Bob's NodeAnnouncement is in the remote batch. Everything else
   (ChannelAnnouncement, ChannelUpdate x2, and Alice's NodeAnnouncement)
   is in the local batch.
5. The remote batch (containing Bob's NodeAnnouncement) runs before the
   local batch since they are spawned in separate goroutines. This means
   that Alice sends Carol the NodeAnnouncement before Carol knows of the
   channel.

In step 2), Bob's NodeAnnouncement (isRemote = true) replaces Bob's
NodeAnnouncement that Alice was going to relay (isRemote = false) after
processing the AnnouncementSignatures.
2023-02-17 14:10:19 +08:00
yyforyongyu
b73cfc5998
discovery: split sendBatch into local and remote
This commit refactors the method `sendBatch` into `sendLocalBatch` and
`sendRemoteBatch` for clarity. The batch size calculation is also moved
into `splitAnnouncementBatches`.
2023-02-17 14:10:10 +08:00
yyforyongyu
c3d1d3c4f1
multi: make SubBatchDelay configurable
This commit adds a new config option `--gossip.sub-batch-delay` so we
can speed up our itest.
2023-02-17 14:10:09 +08:00
yyforyongyu
c6c218f384
discovery: fix confusing loggings 2023-02-17 14:10:09 +08:00
yyforyongyu
89b0e25e2c
multi: add lnutils to host fundamental utility functions
We also move the `fn/stream.go` into the package `lnutils`. Eventually
we will put all the [utility
functions](https://github.com/lightninglabs/taro/tree/main/chanutils)
into this package.
2023-01-19 06:38:50 +08:00
Olaoluwa Osuntokun
f94a67a26d
discovery: properly set the isRemote field for validated networkMsg
This wasn't set properly, leading to some test failures after the prior
change.
2022-12-15 11:56:44 -08:00
Olaoluwa Osuntokun
52451b37af
discovery: ensure we prioritize sending out our own local announcements
In this commit, we modify our gossip broadcast logic to ensure that we
always will send out our own gossip messages regardless of the
filtering/feature policies of the peer.

Before this commit, it was possible that when we went to broadcast an
announcement, none of our peers actually had us as a syncer peer (lnd
terminology). In this case, the FilterGossipMsg function wouldn't do
anything, as they don't have an active timestamp filter set. When we go
to them merge the syncer map, we'd add all these peers we didn't send
to, meaning we would skip them when it came to broadcast time.

In this commit, we now split things into two phases: we'll broadcast
_our_ own announcements to all our peers, but then do the normal
filtering and chunking for the announcements we got from a remote peer.

Fixes https://github.com/lightningnetwork/lnd/issues/6531
Fixes https://github.com/lightningnetwork/lnd/issues/7223
Fixes https://github.com/lightningnetwork/lnd/issues/7073
2022-12-15 11:56:41 -08:00
Olaoluwa Osuntokun
9a4701d709
discovery: add new msgsToBroadcast struct
This struct will be used to later on do filtering when we go to
broadcast, based on if a message was locally sourced or granted from a
remote peer.
2022-12-15 11:56:38 -08:00
Olaoluwa Osuntokun
e8177ea427
discovery: add isLocal bool to msgWithSenders
This lets us keep track of which messages we created ourselves vs the
messages that originated remotely from a peer.
2022-12-15 11:56:36 -08:00
yyforyongyu
443095a907
discovery: signal allow for ignored channel announcements
This commit makes the `handleChanAnnouncement` always returning `true`
for messages processed but ignored by router, even when the extracted
announcements are empty.
Previously we'd return false when the announcements are empty, which
could cause `ChannelUpdate`s being ignored since the validation barrier
will signal deny for the jobs. This can easily be trigger using
following setup,
1. Alice connects to Bob and open a channel.
2. Alice connects to Carol, Bob connects to Carol.
3. Once the channel is open, Alice and Bob will both announce it to Carol.

At some point, we'd have the following messages in Carol's node,
- Alice's ChannelAnnouncement
- Alice's ChannelUpdates, for both directions
- Bob's ChannelAnnouncement
- Bob's ChannelUpdates, for both directions

And a bug could happen, if,
- Alice's ChannelAnnouncement is processed by router, hence added to db,
  but not reporting back to gossiper yet, so the validation barrier
  hasn't sent signal allow.
- Bob's ChannelAnnouncement is processed by router, and returned
  `ErrIgnored` as the edge info is already in db, and reported back to
  gossiper, the validation barrier will signal deny to all the
  ChannelUpdates jobs.
- Depending on how fast Alice's ChannelAnnouncement is processed, we may
  get zero to four denies to the above ChannelUpdates, causing a channel
  edge policy never being updated.
2022-12-08 17:57:02 +08:00
yyforyongyu
716c685f10
discovery+peer: add logs to reveal shutdown flow
Also adds a `TODO` for checking the err chan.
2022-12-08 17:57:01 +08:00
yyforyongyu
152a438fbe
discovery: move shouldBroadcast inside goroutine
This commit moves the `shouldBroadcast` logic closer to the execution
logic of deciding whether we want to broadcast the announcements. This
is a pure code refactor and should make no difference in announcing
message unless the `d.syncMgr.IsGraphSynced()` gives different results
inside the goroutine.
2022-12-08 17:57:01 +08:00
yyforyongyu
b237dbfd74
discovery: add method handleNetworkMessages to process messages 2022-12-08 17:57:01 +08:00
yyforyongyu
26d1a41926
discovery+routing: add more logs to reveal channel update flow 2022-12-08 17:57:01 +08:00
Oliver Gugger
55b53555e9
multi: improve readability of goroutine defers
This commit fixes the readability of some of the defer calls in
goroutines by making sure the defer stands out properly.
2022-11-21 13:54:24 +01:00
Eng Zer Jun
dbf3cf62fe
discovery: use T.TempDir to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-24 08:58:16 +08:00
yyforyongyu
0735522194
multi: fix make fmt 2022-08-23 22:10:24 +08:00
Olaoluwa Osuntokun
08f1c2e93a
chainntfns: add new option for conf notifications to send block
In this commit, we add a new option for the existing confirmation
notification system that optionally allows the caller to specify that a
block should be included as well.

The only quirk w/ the implementation here is the neutrino backend:
usually we get filtered blocks, we so need to first fetch the block
again so we can deliver the full block to the notifier. On the notifier
end, it'll only be checking for the transactions we care about, to
sending a full block doesn't affect the correctness.

We also extend the `testBatchConfirmationNotification` test to assert
that a block is only included if the caller specifies it.
2022-08-01 19:59:21 -07:00
eugene
01f28ba540
server+discovery: alias-handling in gossiper
An OptionalMsgField has been added that allows outside subsystems
to provide a short channel id we should insert into a ChannelUpdate
that we then sign and send to our peer.

When the gossiper receives a ChannelUpdate, it will query the
alias manager by the passed-in FindBaseByAlias function to determine
if the short channel id in the ChannelUpdate points to a known
channel. If this lookup returns an error, we'll fallback to using
the original id in the ChannelUpdate when querying the router.
The lookup and potential fallback must occur in order to properly
lock the multimutex, query the correct router channels, and rate
limit the correct short channel id. An unfortunate side effect of
receiving ChannelUpdates from our peer that reference on of our
aliases rather than the real SCID is that we must store this policy.
Yet it is not broadcast-able. Care has been taken to ensure the
gossiper does not broadcast *any* ChannelUpdate with an alias SCID.

The cachedNetworkMsg uses the new processedNetworkMsg struct. This
is necessary so that delete-and-reinsert in the funding manager
doesn't process a ChannelUpdate twice and end up in a deadlock since
the err chan is no longer being used.
2022-07-07 17:10:28 -04:00
Tommy Volk
9a10c80bcb multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
Olaoluwa Osuntokun
a90dfff9a5
build: update to Go 1.18 2022-04-12 16:14:04 -07:00
eugene
932c5f1a7b
discovery: move ann sig handling to handleAnnSig 2022-03-15 14:35:27 -04:00
eugene
1e9220dab6
discovery: move channel update handling to handleChanUpdate 2022-03-15 14:35:27 -04:00
eugene
914c96d2cf
discovery: move channel ann handling to handleChanAnnouncement 2022-03-15 14:35:27 -04:00
eugene
3bdf0a437d
discovery: move node ann code to handleNodeAnnouncement 2022-03-15 14:35:25 -04:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
yyforyongyu
1ad6bbfbc2
multi: add logs when subservers are starting
Also unified the log messages.
2022-02-11 21:17:03 +08:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
eugene
ead414c689
discovery: use source instead of peer for accurate rejectCache 2022-01-05 04:27:33 +08:00
yyforyongyu
17938b08ac
discovery: resend premature messages when new blocks arrive
This commit adds a method to resend premature when new blocks arrive.
Previously when a message has specified a block+delta in the future, we
would ignore the message and never process it again, causing an open
channel never being broadcast under fast blocks generation. This commit
fixes it by saving the future messages and resending them once the
required block height is reached.
2022-01-05 04:27:33 +08:00
yyforyongyu
8d0cae5e18
discovery: sync blocks in a dedicated goroutine
This commit moves syncing blocks into a dedicated goroutine to avoid the
race condition where several go channels are ready and the block height
update is pushed after a network message is processed.
2022-01-05 04:27:33 +08:00
yyforyongyu
dd74486b59
routing+discovery: uniform error codes in routing 2022-01-05 04:27:33 +08:00
yyforyongyu
c15c8a1f0b
discovery: transit all inactive syncers when needed 2022-01-05 04:27:32 +08:00
yyforyongyu
2250cb752b
discovery: shorten mutex locking closure 2022-01-05 04:27:32 +08:00
yyforyongyu
c1175dcabe
discovery: add verbose network messages related logs 2022-01-05 04:27:32 +08:00
yyforyongyu
46050fc631
multi: enhance logging for debugging peer connection 2021-12-23 15:14:37 +08:00
Olaoluwa Osuntokun
5a8255550b
discovery: revamp recent rejects map
Similar to the prior commit, in this commit, we move to using a basic
LRU cache to store the set of prior rejected messages.
2021-11-04 15:21:20 -07:00
Olaoluwa Osuntokun
8627b5d128
discovery: revamp premature update map
Turns out we need it right now to handle some low latency race
conditions in our integration tests, so we'll opt to simply cap the size
of it to a low amount. We use a basic LRU caching mechainsm.

Fixes https://github.com/lightningnetwork/lnd/issues/5076
2021-11-04 15:21:18 -07:00
Oliver Gugger
e79d59dd4c
multi: use key locator for lnwallet.MessageSigner
To simplify the message signing API even further, we refactor the
lnwallet.MessageSigner interface to use a key locator instead of the
public key to identify which key should be signed with.
2021-10-08 12:06:52 +02:00
Andras Banki-Horvath
11cf4216e4
multi: move all channelstate operations to ChannelStateDB 2021-09-29 17:00:03 +02:00
yyforyongyu
3204e2d74b
multi: add shutdown logs in subservers
This commit adds a simple shutdown to every subserver to assist
debugging.
2021-09-15 19:52:03 +08:00
Joost Jager
3f775778c3
channeldb+routing: add tx parameter
Adds an optional tx parameter to ForAllOutgoingChannels and FetchChannel
so that data can be queried within the context of an existing database
transaction.
2021-08-24 13:43:24 +02:00
Wilmer Paulino
186237ca73
discovery: demote err log to debug from processZombieUpdate
This log can be "spammy" while nodes throughout the network have yet to
upgrade to v0.13.0-beta, which includes several enhancements to prevent
the broadcast of zombie edges/updates.
2021-05-26 13:33:41 -07:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Wilmer Paulino
0ada2288cc
discovery: prevent logging certain validation barrier errors 2021-04-29 15:53:07 -07:00
Olaoluwa Osuntokun
5d1574f566
Merge pull request #2522 from roeierez/cleanup_server_error
Cleanup in case of server failed to start
2021-04-22 13:00:22 -07:00
Olaoluwa Osuntokun
a9f1b341be
discovery: update zombie resurrection test w/ new logic
In this commit, we update the existing zombie resurrection test to
ensure that if we prune an edge and another pubkey is marked as nil,
that we only accept a resurrection channel update from the node the we
originally pruned if the pruning decision was one sided.
2021-04-21 13:56:35 -05:00
Conner Fromknecht
f28a98aa6f
discovery/gossiper: only parse zombie pubkey if non-empty 2021-04-21 13:56:16 -05:00
Conner Fromknecht
4baee9537b
discovery/gossiper: move zombie handling to helper 2021-04-21 13:56:11 -05:00
Olaoluwa Osuntokun
bb6aca1130
discovery: add unit tests for chan anns in the reject cache 2021-04-14 15:19:27 -07:00
Olaoluwa Osuntokun
c959ecc4c9
discovery: always add chan announcements to the reject cache if err != ErrIgnored
In this commit, we make a change to always add chan announcements to the
reject cache if we didn't reject them for already existing.  Without
this change, if we end up rejecting a channel announcement say because
the channel is already spent or the funding transaction doesn't exist,
then we'll end up continually re-validating the same set of channels we
know will fail, when they're sent to us by peers.

Fixes #5191
2021-04-14 15:19:14 -07:00
Roei Erez
3223df74e5 channelnotifier+discover+invoices: return error in Stop functions
In order to be consistent with other sub systems an error is now
returned from the Stop functions.
This also allows writing a generic cleanup mechanism to stop all
sub systems in case of a failure.
2021-04-13 13:26:01 +03:00
Wilmer Paulino
393111cea9
discovery+routing: cancel dependent jobs if parent validation fails
Previously, we would always allow dependent jobs to be processed,
regardless of the result of its parent job's validation. This isn't
correct, as a parent job contains actions necessary to successfully
process a dependent job. A prime example of this can be found within the
AuthenticatedGossiper, where an incoming channel announcement and update
are both processed, but if the channel announcement job fails to
complete, then the gossiper is unable to properly validate the update.
This commit aims to address this by preventing the dependent jobs to
run.
2021-03-23 11:56:51 -07:00
Wilmer Paulino
e713205eea
discovery: add missing error channel sends in processNetworkAnnouncement
Without the error channel sends, we would block the gossip message
stream upon receiving a premature channel announcement.
2021-03-23 11:56:31 -07:00
Olaoluwa Osuntokun
9a6bb19770
lnwire: prep wire messages for TLV extensions
Messages:
- UpdateFulfillHTLC
- UpdateFee
- UpdateFailMalformedHTLC
- UpdateFailHTLC
- UpdateAddHTLC
- Shutdown
- RevokeAndAck
- ReplyShortChanIDsEnd
- ReplyChannelRange
- QueryShortChanIDs
- QueryChannelRange
- NodeAnnouncement
- Init
- GossipTimestampRange
- FundingSigned
- FundingLocked
- FundingCreated
- CommitSig
- ClosingSigned
- ChannelUpdate
- ChannelReestablish
- ChannelAnnouncement
- AnnounceSignatures

lnwire: update quickcheck tests, use constant for Error

multi: update unit tests to pass deep equal assertions with messages

In this commit, we update a series of unit tests in the code base to now
pass due to the new wire message encode/decode logic. In many instances,
we'll now manually set the extra bytes to an empty byte slice to avoid
comparisons that fail due to one message having an empty byte slice and
the other having a nil pointer.
2021-02-24 17:31:55 +01:00
Olaoluwa Osuntokun
dd6f0ba931
discovery+lnwire: remove embedding within ReplyChannelRange
In order to prep for allowing TLV extensions for the `ReplyChannelRange`
and `QueryChannelRange` messages, we'll need to remove the struct
embedding as is. If we don't remove this, then we'll attempt to decode
TLV extensions from both the embedded and outer struct.

All relevant call sites have been updated to reflect this minor change.
2021-02-24 17:31:55 +01:00
Johan T. Halseth
926005aefa
discovery/gossiper: ignore remote ChannelAnnouncement for own channel
To avoid learning about our own channel we have already closed and
removed from our graph, we ignore all ChannelAnns for channels we are
involved in.
2021-02-11 15:13:51 +01:00
Johan T. Halseth
e8f7a11470
gossiper_test: split keys into self/remote
To make it more clear what is local and remote messages, we change to
use `selfKey` only for local messages.
2021-02-11 15:13:51 +01:00
Johan T. Halseth
4268bcc9f9
gossiper_test: combine local/remote chan ann
It will be the same announcement, no need to distinguish.
2021-02-11 15:13:51 +01:00
Johan T. Halseth
f047c3517f
discovery/gossiper: remove source pubkey from ProcessLocalAnnouncement params 2021-02-11 15:13:51 +01:00
Olaoluwa Osuntokun
355b6a260f
Merge pull request #4964 from halseth/gossip-local-no-batch
channeldb+routing+gossiper: add local updates to graph immediately
2021-02-10 18:00:47 -08:00
Conner Fromknecht
1ee5eb97d5
Merge pull request #5006 from wpaulino/new-rate-limit-chan-updates
discovery: use token bucket based rate limiting to throttle gossip
2021-02-10 17:31:41 -08:00
Conner Fromknecht
5afc6b9284
Merge pull request #4945 from cfromknecht/no-graph-sync
discovery: no graph sync
2021-02-10 17:07:24 -08:00
Wilmer Paulino
83a0d03c0b
discovery: use token bucket based rate limiting to throttle gossip
The recently added gossip throttling was shown to be too aggressive,
especially with our auto channel enable/disable signaling. We switch to
a token bucket based system instead as it's based on time, rather than a
block height which isn't constantly updated at a given rate.
2021-02-10 16:21:13 -08:00
Wilmer Paulino
bfc8523873
Revert "discovery: add new option to toggle gossip rate limiting"
This reverts commit 13a2598ded.
2021-02-10 15:45:48 -08:00
Johan T. Halseth
c9afc93151
discovery/gossiper: add local updates to graph immediately
Since the batch interval can potentially be long, adding local updates
to the graph could be slow. This would slow down operations like adding
our own channel update and announcements during the funding process, and
updating edge policies for local channels.

Now we instead check whether the update is remote or not, and only for
remote updates use the SchedulerOption to lazily add them to the graph.
2021-02-10 23:54:03 +01:00
Johan T. Halseth
7e34132c53
routing: let graph methods take scheduler option 2021-02-10 23:54:03 +01:00
Wilmer Paulino
904003fbcb discovery: use source of ann upon confirmed channel ann batch
We do this instead of using the source of the AnnounceSignatures
message, as we filter out the source when broadcasting any
announcements, leading to the remote node not receiving our channel
update. Note that this is done more for the sake of correctness and to
address a flake within the integration tests, as channel updates are
sent directly and reliably to channel counterparts.
2021-02-10 13:22:28 -08:00
Conner Fromknecht
58e924ad1c
discovery: don't historical sync when NumActiveSyncers == 0
Currently when numgraphsyncpeers=0, lnd will still attempt to perform
an initial historical sync. We change this behavior here to forgoe
historical sync entirely when numgraphsyncpeers is zero, since the
routing table isn't being updated anyway while the node is active.

This permits a no-graph lnd mode where no syncing occurs at all.
2021-02-10 09:35:45 -08:00
Olaoluwa Osuntokun
555de44d9f Revert "Merge pull request #4895 from wpaulino/disallow-premature-chan-updates"
This reverts commit 6e6384114c, reversing
changes made to 98ea433271.
2021-02-09 19:55:45 -08:00
Conner Fromknecht
b1fee734ec
discovery/sync_manager: remove unneeded markGraphSyncing
AFAICT it's not possible to flip back from bein synced_to_chain, so we
remove the underlying call that could reflect this. The method is moved
into the test file since it's still used to test correctness of other
portions of the flow.
2021-01-29 00:19:48 -08:00
Conner Fromknecht
e42301dee2
lntest: call markGraphSynced from gossipSyncer
Rather than performing this call in the SyncManager, we give each
gossipSyncer the ability to mark the first sync completed. This permits
pinned syncers to contribute towards the rpc-level synced_to_graph
value, allowing the value to be true after the first pinned syncer or
regular syncer complets. Unlinke regular syncers, pinned syncers can
proceed in parallel possibly decreasing the waiting time if consumers
rely on this field before proceeding to load their application.
2021-01-29 00:19:48 -08:00
Conner Fromknecht
fcd5cb625a
config: expose gossip.pinned-syncers for conf
The pinned syncer set is exposed as a comma-separated list of pubkeys.
2021-01-29 00:19:47 -08:00
Conner Fromknecht
340414356d
discovery: perform initial historical sync for pinned peers 2021-01-29 00:19:47 -08:00
Conner Fromknecht
2f0d56d539
discovery: add support for PinnedSyncers
A pinned syncer is an ActiveSyncer that is configured to always remain
active for the lifetime of the connection. Pinned syncers do not count
towards the total NumActiveSyncer count, which are rotated periodically.

This features allows nodes to more tightly synchronize their routing
tables by ensuring they are always receiving gossip from distinguished
subset of peers.
2021-01-29 00:19:47 -08:00
Conner Fromknecht
9e932f2a64
discovery/sync_manager: Pause/Resume HistoricalSyncTicker
This gives each initial historical syncer an equal amount of time before
being rotated, even if some fail.
2021-01-29 00:19:47 -08:00
Conner Fromknecht
ef0cd82c1f
discovery/sync_manager: make setHistoricalSyncer closure 2021-01-29 00:19:46 -08:00
Conner Fromknecht
72fbd1283b
discovery/sync_manager: break out IsGraphSynced check 2021-01-29 00:19:46 -08:00
Conner Fromknecht
7c6aa20bd8
discovery: handle err for linter 2021-01-29 00:19:46 -08:00
Wilmer Paulino
7ef1f3f636
discovery: use source of ann upon confirmed channel ann batch
We do this instead of using the source of the AnnounceSignatures
message, as we filter out the source when broadcasting any
announcements, leading to the remote node not receiving our channel
update. Note that this is done more for the sake of correctness and to
address a flake within the integration tests, as channel updates are
sent directly and reliably to channel counterparts.
2021-01-06 13:16:44 -08:00
Wilmer Paulino
00d4e92362
discovery: prevent rebroadcast of premature channel updates
As similarly done with premature channel announcements, we'll no longer
allow premature channel updates to be rebroadcast once mature. This is
no longer necessary as channel announcements that we're not aware of are
usually broadcast to us with their accompanying channel updates.
2021-01-06 12:52:41 -08:00
Wilmer Paulino
871a6f1690
discovery: prevent rebroadcast of previously premature announcements 2020-12-08 15:18:08 -08:00
Wilmer Paulino
a4f33ae63c
discovery: adhere to proper channel chunk splitting for ReplyChannelRange 2020-12-08 15:18:07 -08:00
Wilmer Paulino
c5fc7334a4
discovery: limit NumBlocks to best known height for outgoing QueryChannelRange
This is done to ensure we don't receive replies for channels in blocks
not currently known to us, which we wouldn't be able to process.
2020-12-08 15:18:06 -08:00