Commit Graph

4304 Commits

Author SHA1 Message Date
cd8a21c4b8 walletunlocker: pass unlocked wallet back to lnd to avoid double unlock 2018-06-12 19:27:57 -07:00
7303a65ad1 lnd: use unlocked wallet from WalletUnlocker for chain control 2018-06-12 19:27:57 -07:00
24a085bf7d btcwallet: extend config to allow passing of an unlocked wallet 2018-06-12 19:27:56 -07:00
4cefb6b8dc btcwallet: use already unlocked wallet if available 2018-06-12 19:27:56 -07:00
8f2a8d6682 chainregistry: pass initialized wallet to chain control 2018-06-12 19:27:56 -07:00
f7156aa1d6 Merge pull request #1109 from wpaulino/nat-traversal
server: add support for NAT traversal and watching dynamic IP changes
2018-06-12 19:13:43 -07:00
c1886d2c1c docs: add NAT traversal related documentation 2018-06-12 18:40:13 -07:00
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
2ad9823945 server: include optional updates when generating a new node announcement 2018-06-12 18:36:29 -07:00
d635994272 lnwire: add functional option that updates a node announcement's addresses 2018-06-12 18:36:28 -07:00
377e770db4 nat: introduce new NAT traversal package with UPnP/NAT-PMP implementations
In this commit, we introduce a new package `nat`. This package is
responsible for handling the different techniques for NAT traversals.
Specifically, we have implemented UPnP and NAT-PMP support. This will
allow users to easily advertise their nodes to the network as long as
their devices are behind a single NAT. Devices behind multiple NATs are
not supported.
2018-06-12 18:36:27 -07:00
8651b4a422 config: clarify documentation for NAT traversal flag 2018-06-12 18:36:24 -07:00
5732f5a1c4 config: normalize external IPs when parsing config 2018-06-12 18:32:49 -07:00
d17a561d8b build: include NAT traversal related dependencies 2018-06-12 18:32:48 -07:00
ba0db4ce91 Added some additional comments 2018-06-12 18:32:47 -07:00
1c3df21d18 Added NatPmp option 2018-06-12 18:32:46 -07:00
0d0078baac Continue with server startup, even if UPNP has failed 2018-06-12 18:32:45 -07:00
b59077109c Added Upnp support behind a configuration option, moved the logic to the server code 2018-06-12 18:32:44 -07:00
9a3dfaf332 Merge changes ontop of master 2018-06-12 18:32:43 -07:00
80b531db62 Merge pull request #1303 from vegardengen/fix-docs-push-amount
Add clarification for push_amt argument to openchannel
2018-06-12 17:27:19 -07:00
c3191a7728 Merge pull request #1349 from Roasbeef/server-fixes-itest-stability
test+server: finalize inbound/outbound fixes, update itests to account for fixes
2018-06-12 12:32:55 -07:00
e60d2b774a htlcswitch: in event of duplicate link add, prefer newer link 2018-06-12 00:44:30 -07:00
e1d8c37708 peer: only add an active link to the channelManager if addPeer succeeds
In this commit we fix an existing bug which could cause internal state
inconsistency between then switch, funding manager, and the peer. Before
this commit, we would _always_ add a new channel to the channelManager.
However, due to recent logic, it may be the case that this isn't the
channel that will ultimately reside in the link. As a result, we would
be unable to process incoming FundingLocked messages properly, as we
would mutate the incorrect channel in memory.

We remedy this by moving the inserting of the new channel into the
activeChannels map until the end of the loadActiveChannels method, where
we know that this will be the link that persists.
2018-06-12 00:44:26 -07:00
3db06cf7d5 htlcswitch: in removeLink properly remove items from the interfaceIndex
In this commit, we fix a bug in the way we handle removing items from
the interfaceIndex. Before this commit, we would delete all items items
with the target public key that of the peer that owns the link being
removed. However, this is incorrect as the peer may have other links
sill active.

In this commit, we fix this by first only deleting the link from the
peer's index, and then checking to see if the index is empty after this
deletion. Only if so do we delete the index for the peer all together.
2018-06-11 23:06:22 -07:00
03810603ee htlcswitch: modify interfaceIndex to no longer key 2nd lvl by ChannelLink
In this commit, we modify the interfaceIndex to no longer key the second
level of the index by the ChannelLink. Instead, we'll use the chan ID as
it's a stable identifier, unlike a reference to an interface.
2018-06-11 23:02:16 -07:00
1a15924d65 discovery: fix log for adding new gossip syncers
In this commit, we fix the logging when adding new gossip syncers. The
old log would log the byte array, rather than the byte slice. We fix
this by slicing before logging.
2018-06-11 22:58:30 -07:00
418ecbaa15 test: fix flake by allowing channel to load before close 2018-06-10 23:02:23 -07:00
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
8885c3de8d server: defer cancelling the outbound connection until the tie-breaker 2018-06-10 23:02:22 -07:00
179b25c580 test: update switch persistence tests to account for bug fix in reconnection logic
With the recent bug fixes in the peer connection, it's no longer the
case that just disconnecting a certain peer causes it to no longer
connect to the other. As a result, we now shutdown Alice to ensure no
reconnection occurs. We'll then later restart alice when we restart
dave.
2018-06-10 23:02:22 -07:00
7f16e99a80 lntest: add new StopNode method 2018-06-10 23:02:21 -07:00
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
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
2e838abb3f Merge pull request #1350 from cfromknecht/switch-duplicate-links
Switch duplicate links
2018-06-10 18:13:26 -07:00
9c0c9baee0 Merge pull request #1345 from cfromknecht/gossip-direct-send-msg
discovery: bypass server for direct message sends
2018-06-10 16:38:23 -07:00
e5233c8ec7 htlcswitch/switch: reject duplicate links, purge link indexes 2018-06-09 04:33:04 -07:00
a779befda5 htlcswitch/switch_test: adds duplicate link add test 2018-06-09 04:28:03 -07:00
4dace6c941 htlcswitch/multi: update tests for lnpeer.Peer iface 2018-06-08 16:29:49 -07:00
4380c67124 htlcswitch/link: upgrade to use lnpeer.Peer.SendMessage 2018-06-08 16:29:49 -07:00
3046ea6c5b htlcswitch/interfaces: removes Peer iface, use new lnpeer.Peer 2018-06-08 16:29:48 -07:00
bf515a2341 discovery/gossiper: mostly deprecate SendToPeer
This commit changes the gossiper to direct messages to
peer objects, instead of sending them through the
server every time. The primary motivation is to reduce
contention on the server's mutex and, more importantly,
avoid deadlocks in the Triangle of Death.
2018-06-08 16:29:48 -07:00
a670537f4c server: expose FindPeer for lnpeer.Peer to gossiper 2018-06-08 13:47:57 -07:00
edf08458c1 peer: changes to satisfy lnpeer.Peer
This commit adds:
 - variadic SendMessage method (w/ sync bool reorder)
 - passes peer object directly to ProcessRemoteAnnouncment
 - adds IdentityKey() method for lnpeer.Peer
2018-06-08 13:47:57 -07:00
769f0f0a94 discovery/gossiper_test: mock out new lnpeer.Peer 2018-06-08 13:47:57 -07:00
dcf76a59b2 lnpeer: birth of peer package!
This commit moves the generic interface for
Lightning Network peers so that it can be
imported directly into the switch and gossiper.
Eventually, the majority of the peer logic
would be moved into this package for testing
and modularization.
2018-06-08 13:47:57 -07:00
15f812b10f lnwire: don't attempt to decode an empty/nil signature 2018-06-08 13:25:56 -07:00
4bde4c1c26 Merge pull request #1333 from Roasbeef/min-fee-rate
funding+htlcswitch: enforce min fee rate of 253 sat/kw on commitments
2018-06-06 21:00:13 -07:00
0177309dcf cmd/lncli: modify sendtoroute cmd to make reading routes from stdin optional
In this commit we modify the existing sendtoroutes command such that
users can either specify the route over stdin (using the special '-'
flag), via the keyword argument, or via the positional argument.
2018-06-06 20:45:57 -07:00
bc9eca32ab rpc: refactor logic for SendPayment+SendToRoute
In this commit, we modify the logic for the two primary payment related
RPCs to reduce duplication, indentation, and consolidate logic. As a
result, we'll now accept rpcPaymentIntents, turn those into regular
paymentIntents (convert from proto) before finally dispatching via
unified function.
2018-06-06 20:45:56 -07:00
eb65b0cd5a routing: check to see if pubkey is nil before logging in sendPayment
In this commit, we now need to check to see if the pubkey is nil as if
the user specified a set of manual routes, then the dest pubkey would be
empty.
2018-06-06 20:45:56 -07:00