Commit Graph

317 Commits

Author SHA1 Message Date
Wilmer Paulino
59c404a6d3
server: ensure persistent connections to tor addrs are made if active
In this commit, we restrict the persistent connection logic on startup
to only attempt to establish connections to Tor addresses if Tor
outbound support is enabled. Otherwise, we'll continually attempt to
reach the address even though we never will.
2018-09-06 18:51:19 -07:00
Olaoluwa Osuntokun
4100dfcf6b
Merge pull request #1801 from cfromknecht/remove-initial-graph-sync-request
server: Stop requesting initial graph sync
2018-09-05 19:16:56 -07:00
Olaoluwa Osuntokun
d2a7d910b7
Merge pull request #1825 from Roasbeef/extra-gossip-message-data
channeldb+discovery: ensure we store, validate and propagate announcements with opaque data
2018-09-05 17:53:02 -07:00
Olaoluwa Osuntokun
d1a80e35ef
Merge pull request #1841 from cfromknecht/sync-gq-start
peer: Synchronous registration of gossip queries
2018-09-05 16:37:03 -07:00
Olaoluwa Osuntokun
7808288249
chanseries+server: populate ExtraOpaqueData field when reading from disk 2018-09-04 20:52:45 -07:00
Olaoluwa Osuntokun
309e656a97
Merge pull request #1839 from cfromknecht/assume-channel-valid
routing: Assume channel valid
2018-09-04 20:50:06 -07:00
Olaoluwa Osuntokun
7435fba78b
Merge pull request #1836 from cfromknecht/reconnect-to-all-known-addrs
server: Reconnect to all known addrs for persistent peers
2018-09-04 19:44:35 -07:00
Conner Fromknecht
2415675c3d
server: move gossip dispatch to peer
See next commit msg for more detail.
2018-09-04 17:28:50 -07:00
Conner Fromknecht
21a4e21863
server: stop requesting initial graph sync
In this commit, we remove signaling for initial routing
dumps, which create unnecessary log spam, bandwidth, and
CPU. Now that gossip syncing is in full force, we will
instead opt to use the more efficient querying/set
reconciliation. Other nodes may still request initial
gossip sync from us, and we will respond.
2018-09-04 05:04:21 -07:00
Conner Fromknecht
8d7eb41d48
server: always backoff for unstable peers
This commit modifies the connection peer backoff
logic such that it will always backoff for "unstable"
peers. Unstable in this context is determined by
connections whose duration is shorter than 10
minutes. If a disconnect happens with a peer
whose connection lasts longer than 10 minutes,
we will scale back our stored backoff for that peer.

This resolves an issue that would result in a tight
connection loop with remote peers. This stemmed
from the connection duration being very short,
and always driving the backoff to the default
backoff of 1 second. Short connections like
this are now caught by the stable connection
threshold.

This also modifies the computation on the
backoff relaxation to subtract the connection
duration after applying randomized exponential
backoff, which offers better stability when
the connection duration and backoff are roughly
equal.
2018-09-04 03:40:08 -07:00
Conner Fromknecht
f33cfdaa07
server: pass AssumeChannelValid to router 2018-09-03 20:15:18 -07:00
Conner Fromknecht
09992f3fb0
server: remove unused lightningID field 2018-09-03 18:11:25 -07:00
Conner Fromknecht
9c35528fce
server: attempt reconnection to all known addresses 2018-09-03 18:11:21 -07:00
Wilmer Paulino
16b412fb51
server: avoid logging error if no links are found
In this commit, we avoid logging an error when the links associated with
a peer are not found within its termination watcher. We do this to
prevent a benign log message as the links have already been removed from
the switch.
2018-08-28 20:34:19 -07:00
Olaoluwa Osuntokun
745cc3a8f4
server: don't attempt to disable private channels 2018-08-25 17:30:08 -07:00
Olaoluwa Osuntokun
a1a6845fb5
Merge pull request #1731 from halseth/link-policy-persist
Correctly apply min_htlc to forwarding policy
2018-08-23 19:21:44 -07:00
Johan T. Halseth
19e3a194fa
peer+server: make fetchLastChanUpdate _always_ fetch our own update
This commit fixes a bug that would cause us to fetch our peer's
ChannelUpdate in some cases, where we really wanted to fetch our own.

The reason this happened was that we passed the peer's pubkey to
fetchLastChanUpdate, making us match on their policy. This would lead to
ChannelUpdates being sent during routing which would have no effect on
the attempted path.

We fix this by always use our own pubkey in fetchLastChanUpdate, and
also uses the common methods within the server to be able to extract the
update even when only one policy is known.
2018-08-23 07:50:18 +02:00
Johan T. Halseth
de5e9e139c
server: make extractChannelUpdate extract from set of potential policies 2018-08-23 07:50:17 +02:00
Johan T. Halseth
67d36eb79d
funding: make SendAnnouncement return error chan instead of error 2018-08-23 07:40:41 +02:00
Wilmer Paulino
6c903393e5 router+server: use first hop channel id rather than node key 2018-08-20 21:04:52 -07:00
Olaoluwa Osuntokun
3f5ec99330
server: properly unlock within openchannel if peer not found 2018-08-18 18:17:55 -07:00
Olaoluwa Osuntokun
147596047f
Merge pull request #1687 from halseth/disable-inactive-channels
Send ChannelUpdate with Disabled bit if channel inactive for 20 minutes
2018-08-17 18:04:19 -07:00
Johan T. Halseth
4581aa313c
server: handle case where both policies are not present in fetchLastChanUpdateByOutPoint 2018-08-17 23:24:13 +02:00
Johan T. Halseth
5deffd228c
peer: call disableChannel with disabled=false after loading channels
This to ensure now active channel is available in the router, for path
finding, as it might have been disabled if the peer has been offline a
while.
2018-08-17 23:24:13 +02:00
Johan T. Halseth
e9cc7492a9
server: add goroutine watchChannelStatus
This commit adds a goroutine watchChannelStatus to the server, which
will query the switch for the status of all open channels every
InactiveChanTimeout / 4. If a channel's status has remained unchanged
during the last InactiveChanTimeout it'll send out a ChannelUpdate
setting the disabled bit accordingly.
2018-08-17 23:24:13 +02:00
Johan T. Halseth
b5bfdd72b5
server+peer: rename disableChannel->announceChanStatus
Now takes a boolean whether to disable/activate, and keeps track of the
last update sent to avoid sending duplicates.
2018-08-17 23:24:12 +02:00
Johan T. Halseth
304577f617
server: make sure timestamp always increases when creating new ChannelUpdate 2018-08-17 23:24:12 +02:00
Johan T. Halseth
8826db32e8
server: let gossiper hand policy update to router
ProcessLocalAnnouncement will attempt to call UpdateEdge with the new
policy. If we call it manually before handing it to the gossiper, that
call will fail with "Outdated" and the announcement won't propagate.
2018-08-17 23:24:12 +02:00
Wilmer Paulino
2908f672c3
server: add minConfs field to openChanReq 2018-08-16 20:19:27 -07:00
Wilmer Paulino
5c414bb1d0
multi: make OpenChannel take in openChanReq 2018-08-16 20:19:26 -07:00
Conner Fromknecht
121252934b
server: rearrange peer lifecyle helpers for readability 2018-08-13 21:55:32 -07:00
Conner Fromknecht
0ee0abc166
server: add async peer Start() + safer cleanup
This commit adds asynchronous starting of peers,
in order to avoid potential DOS vectors. Currently,
we block with the server's mutex while peers exchange
Init messages and perform other setup. Thus, a remote
peer that does not reply with an init message will
cause server to block for 15s per attempt.

We also modify the startup behavior to spawn
peerTerminationWatchers before starting the
peer itself, ensuring that a peer is properly
cleaned up if the initialization fails. Currently,
failing to start a peer does not execute the bulk
of the teardown logic, since it is not spawned
until after a successful Start occurs.
2018-08-13 21:52:37 -07:00
Conner Fromknecht
a6e7b35872
server: use blocking RemoveLink to shutdown links 2018-08-10 11:42:25 -07:00
Olaoluwa Osuntokun
61f5b3e3f1
Merge pull request #1709 from Empact/noisedial
Move noiseDial from config.go to server.go
2018-08-09 21:43:37 -07:00
Olaoluwa Osuntokun
d3b1b9aa98
Merge pull request #1668 from cfromknecht/interface-tickers
Ticker Package
2018-08-09 20:55:25 -07:00
Wilmer Paulino
9d2eeb6304
multi: update to latest fee estimation interface 2018-08-09 17:29:52 -07:00
Ben Woosley
896128efd0
Move noiseDial from config.go to server.go
noiseDial is only called from server.go, has nothing to do with configuration,
and moving it removes config.go's reliance on btcec and brontide.
2018-08-09 15:13:05 -04:00
Conner Fromknecht
d5d01dd575
server: configure switch w/ default log/fwd tickers 2018-08-09 02:48:07 -07:00
Olaoluwa Osuntokun
97f9759ee1
Merge pull request #1675 from cfromknecht/peer-backoff-backoff
server: peer backoff backoff
2018-08-08 20:03:28 -07:00
Wilmer Paulino
0de0a39291
server: prevent increasing epochErrors if conn was established
In this commit, we fix a small bug where we would increase epochErrors
by one even if connections were successfully established. Due to this,
we would stay stuck inside of the peer bootstrapper loop without
requerying for new peers.
2018-08-08 17:24:14 -07:00
Conner Fromknecht
a704c67791
server: compute backoff with connection duration relaxation 2018-08-07 14:50:11 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Olaoluwa Osuntokun
33979b2636
funding+server: move initialization of funding manager into the server
In this commit, we move the initialization of the server into the
funding manager itself. We do this as it's no longer the case that _any_
RPC needs to access the funding manager. In the past, this was the
only reason that the funding manager was instantiated outside of the
server: to be able to respond to queries _before_ the server was
started.

This change also fixes a bug as atm, the funding manager will try to
register for notifications _before_ the ChainNotifier itself has fully
started.
2018-08-01 16:02:55 -07:00
Olaoluwa Osuntokun
e0baa49690
Merge pull request #1387 from wpaulino/send-disable-chan-update
multi: send a channel update with disabled flag set on channel close
2018-07-23 17:46:37 -07:00
Olaoluwa Osuntokun
bca926d6af
Merge pull request #1371 from wpaulino/prune-link-nodes
server: prune link nodes without any open channels
2018-07-21 18:55:38 -07:00
Wilmer Paulino
9cedef9245
fundingmanager: send messages to peers directly
In this commit, we modify the existing message sending functionality
within the fundingmanager. Due to each mesage send requiring to hold the
server's lock to retrieve the peer, we might run into a case where the
lock is held for a larger than usual amount of time and would therefore
block on sending the message within the fundingmanager. We remedy this
by taking a similar approach to some recent changes within the gossiper.
We now keep track of each peer within the internal fundingmanager
messages and send messages directly to them.
2018-07-19 12:34:11 -07:00
Wilmer Paulino
04c5eba194
server: modify NotifyWhenOnline to return the peer once connected 2018-07-19 12:32:32 -07:00
Wilmer Paulino
0aa1f39af8
channeldb+server: prune link nodes on startup
In this commit, we extend the server's functionality to prune link nodes
on startup. Since we currently only decide whether to prune a link node
from the database based on a channel close, it's possible that we have
link nodes lingering from before this functionality was added on.
2018-07-17 17:35:31 -07:00
Wilmer Paulino
38b52df51f
peer+server: remove persistent connections for peers with no open channels remaining 2018-07-17 17:35:30 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00