Commit Graph

279 Commits

Author SHA1 Message Date
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
Wilmer Paulino
873cccc7a6
multi: send channel update with disabled active on force and coop chan closes 2018-07-11 17:07:03 -07:00
Olaoluwa Osuntokun
2c08a22ed3
server: launch new invoiceRegistry goroutines on start up 2018-07-06 12:22:00 -07:00
Conner Fromknecht
5be6993a56
server: log pubkey hex in connection callbacks 2018-07-03 17:09:10 -07:00
Olaoluwa Osuntokun
17399994e4
config+server: update usage of lncfg methods to pass in resolver
In this commit, we update all the lncfg methods used to properly pass in
a new resolver. This is required in order to ensure that we don't leak
our DNS queries if Tor mode is active.
2018-06-27 18:10:34 -07:00
Olaoluwa Osuntokun
c03f731643
server: properly use the set of normalized external ips 2018-06-27 16:43:38 -07:00
Oliver Gugger
c1b1dd96ef
lncfg: move configuration helper methods to new package 2018-06-14 08:19:09 +02:00
Oliver Gugger
460fa25871
config+lnd+server: add unix socket support 2018-06-14 08:19:09 +02:00
Wilmer Paulino
8198466972
multi: move block epochs dependency from links to switch
In this commit, we move the block height dependency from the links in
the switch to the switch itself. This is possible due to a recent change
on the links no longer depending on the block height to update their
commitment fees.

We'll now only have the switch be alerted of new blocks coming in and
links will retrieve the height from it atomically.
2018-06-13 17:41:21 -07:00
Wilmer Paulino
9593e3772e
server: improve initial peer bootstrapping
In this commit, we address an existing issue with regards to the inital
peer bootstrapping stage. At times, the bootstrappers can be unreliable
by providing addresses for peers that no longer exist/are currently
offline. This would lead to nodes quickly entering an exponential
backoff method used to maintain a minimum target of peers without first
achieving said target.

We address this by separating the peer bootstrapper into two stages: the
initial peer bootstrapping and maintaining a target set of nodes to
maintain an up-to-date view of the network. The initial peer
bootstrapping stage has been made aggressive in order to provide such
view of the network as quickly as possible. Once done, we continue on
with the existing exponential backoff method responsible for maintaining
a target set of nodes.
2018-06-13 08:59:36 -07:00
Wilmer Paulino
6a6b490b50
server: add support to automatically advertise external IPs using NAT
traversal

In this commit, we allow our node to automatically advertise its
connection's external IPs on the ports it is currently listening on in
order to accept inbound connections. This is only done when specifying
a NAT traversal technique when starting the daemon.

We also include a handy method that watches for dynamic IP changes in
the background. If a new IP is detected, we'll craft a new node
announcement using the new IP and broadcast it to the network.
2018-06-12 18:36:30 -07:00
Wilmer Paulino
2ad9823945
server: include optional updates when generating a new node announcement 2018-06-12 18:36:29 -07:00
John Griffith
ba0db4ce91
Added some additional comments 2018-06-12 18:32:47 -07:00
John Griffith
1c3df21d18
Added NatPmp option 2018-06-12 18:32:46 -07:00
John Griffith
0d0078baac
Continue with server startup, even if UPNP has failed 2018-06-12 18:32:45 -07:00
John Griffith
b59077109c
Added Upnp support behind a configuration option, moved the logic to the server code 2018-06-12 18:32:44 -07:00
Olaoluwa Osuntokun
15da55effb
server: finish correction of inbound/outbound within the server
In this commit, we finish the fix for the inbound/outbound peer bool in
the server. The prior commit forgot to also flip the inbound/output maps
in Inbound/Outbound peer connected. As a result, the checks were
incorrect and could cause lnd to refuse to accept any more inbound
connections in the case of a concurrent connection attempt.
2018-06-10 23:02:22 -07:00
Olaoluwa Osuntokun
8885c3de8d
server: defer cancelling the outbound connection until the tie-breaker 2018-06-10 23:02:22 -07:00
Olaoluwa Osuntokun
c975753f1e
server: remove pending conn request if we recv a outbound conn after a scheduled callback
In this commit, we ensure that if we're already ignoring a connection,
then we also ignore the pending persistent connection request.
Otherwise, we'll move to accept the replaced connection, but then
continue to attempt connection requests.
2018-06-10 23:02:15 -07:00
Olaoluwa Osuntokun
dcf841c33b server: look up latest addr for node in peerTerminationWatcher
In this commit, we modify the look up for inbound peers to ensure that
we connect to the "freshest" address until we need to execute the
peerTerminationWatcher. We do this as it's possible for a channel to be
created by the remote peer during our session. If we don't query for the
node's address at the latest point, then we'll miss this new node
announcement for the node.
2018-06-10 23:02:10 -07:00
Conner Fromknecht
a670537f4c
server: expose FindPeer for lnpeer.Peer to gossiper 2018-06-08 13:47:57 -07:00
Olaoluwa Osuntokun
849ee5e0dc
Merge pull request #1008 from wpaulino/peer-connection-logic
server: fix inbound/outbound peer connection logic
2018-06-06 18:07:18 -07:00
Wilmer Paulino
09253eacc3
server: use correct inbound value for peerConnected calls
In this commit, we address the meaning of the inbound parameter to
peerConnected. An inbound connection is defined as a connection
initiated by the peer, rather than ourselves.

We also update the inbound value for the peerConnected calls within
OutboundPeerConnected and InboundPeerConnected to reflect the definition
above.
2018-06-06 16:30:40 -07:00
Johan T. Halseth
ac1ab6f516
server: hold mutex shorter during broadcast
We remove the internale broadcastMessage method, and instead handle the
mutex handling within BroadcastMessage. This lets us hold the mutex only
when neccessary.
2018-06-06 12:20:25 +02:00
Johan T. Halseth
b8512c3568
server: don't hold mutex while sending to peer
This commit removes the sendToPeer method from the server, and instead
moves the necessary logic into SendToPeer. This let's us make the mutex
acquisition more fine-grained, only holding it while reading from the
peer map. Earlier it was required to be held during the whole call to
sendToPeer, as the method would access the map internally.
2018-06-06 12:20:06 +02:00
Olaoluwa Osuntokun
d98d4523e1
Merge pull request #1159 from wpaulino/onion-service-support
multi: add onion services support
2018-06-04 21:46:51 -07:00
Wilmer Paulino
2e0484be19
multi: ensure addresses are no longer assumed to be TCP addresses only
In this commit, we go through the codebase looking for TCP address
assumptions and modifying them to include the recently introduced onion
addresses. This enables us to fully support onion addresses within the
daemon.
2018-06-04 20:41:49 -07:00
Wilmer Paulino
08f80b6cf3
server: use advertised address when reestablishing inbound connections
In this commit, we update the way we reestablish inbound connections if
we lose connectivity to a node we have an open channel with. Rather than
fetching the node's advertised port, we'll fetch one of their advertised
addresses instead. This ensure that if the remote node is running behind
a proxy, we do not see the proxy's address.
2018-06-04 20:41:48 -07:00
Wilmer Paulino
1012f876e1
server: add automatic creation of v2 onion services
In this commit, we allow the daemon to use the recently introduced Tor
Controller implementation. This will automatically create a v2 onion
service at startup in order to listen for inbound connections over Tor.

Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:45 -07:00
Wilmer Paulino
3bb1733fa2
discovery+server: use network-specific functions for fallback SRV lookup
In this commit, we fix a bug where a fallback SRV lookup would leak
information if `lnd` was set to route connections over Tor. We solve
this by using the network-specific functions rather than the standard
ones found in the `net` package.
2018-06-04 20:41:43 -07:00
Wilmer Paulino
3669a40c52
server: add support to advertise onion addresses
In this commit, we allow `lnd` to properly parse onion addresses in
order to advertise them to the network when set through the
`--externalip` flag.

Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:41 -07:00
maurycy
3be08e69cf multi: 64bit aligment of atomic vars on arm/x86-32 2018-06-04 20:02:34 -07:00
Olaoluwa Osuntokun
d2bcb708f3
server: demote 'sending message' log to trace 2018-06-04 19:50:44 -07:00
Johan T. Halseth
08d9edd059
server: increase updateChan buffer to 2 2018-06-01 08:55:06 +02:00
Olaoluwa Osuntokun
d7b21859d5
server: upon disconnect, prune peer query state from gossiper 2018-05-31 16:30:57 -07:00
Olaoluwa Osuntokun
199bbe2fd4
server: if remote peer knows of gossip queries, skip initial table dump 2018-05-31 16:30:57 -07:00
Olaoluwa Osuntokun
f70f1f318d
server: set the dataloss protect and gossip queries feature bits 2018-05-31 16:30:57 -07:00
Olaoluwa Osuntokun
486f87576c
server: instantiate the chanSeries struct in the gossiper's config 2018-05-31 16:30:56 -07:00
Wilmer Paulino
4a200d28eb
lnd: add interrupt handler to handle shutdown requests while syncing
chain backend
2018-05-23 11:26:07 -04:00