Commit Graph

4476 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
2e838abb3f
Merge pull request #1350 from cfromknecht/switch-duplicate-links
Switch duplicate links
2018-06-10 18:13:26 -07:00
Olaoluwa Osuntokun
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
Johan T. Halseth
5d8aaa94f1
lnd_test: add missing node shutdowns 2018-06-10 10:07:01 +02:00
Johan T. Halseth
abe590b752
lnd_test: shutdown nodes using defers
This commit adds the helper method shutdownAndAssert, and makes us shut
down nodes created temporarily during the test cases using defers
instead of at the end of the test. This makes it easier to remember to
shut them down, as it is done right after they are started.
2018-06-10 10:07:00 +02:00
Johan T. Halseth
226b38fed7
lntest/node: add method Name to get a node's name 2018-06-10 10:07:00 +02:00
Conner Fromknecht
e5233c8ec7
htlcswitch/switch: reject duplicate links, purge link indexes 2018-06-09 04:33:04 -07:00
Conner Fromknecht
a779befda5
htlcswitch/switch_test: adds duplicate link add test 2018-06-09 04:28:03 -07:00
Conner Fromknecht
4dace6c941
htlcswitch/multi: update tests for lnpeer.Peer iface 2018-06-08 16:29:49 -07:00
Conner Fromknecht
4380c67124
htlcswitch/link: upgrade to use lnpeer.Peer.SendMessage 2018-06-08 16:29:49 -07:00
Conner Fromknecht
3046ea6c5b
htlcswitch/interfaces: removes Peer iface, use new lnpeer.Peer 2018-06-08 16:29:48 -07:00
Conner Fromknecht
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
Olaoluwa Osuntokun
b2e24f876b
htlcswitch: ensure the packet queue exits on stop
In this commit, we ensure that the packet queue will always exit, by
continually signalling the main goroutine until it atomically sets a
bool that indicates its has been fully shutdown. It has been observed
that at times the main goroutine will wake up (due to the signal), but
then bypass the select and actually miss the quit signal, as a result
another signal is required. We'll continue to signals in a lazy loop
until the goroutine has fully exited.
2018-06-08 13:51:37 -07:00
Conner Fromknecht
a670537f4c
server: expose FindPeer for lnpeer.Peer to gossiper 2018-06-08 13:47:57 -07:00
Conner Fromknecht
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
Conner Fromknecht
769f0f0a94
discovery/gossiper_test: mock out new lnpeer.Peer 2018-06-08 13:47:57 -07:00
Conner Fromknecht
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
Olaoluwa Osuntokun
15f812b10f
lnwire: don't attempt to decode an empty/nil signature 2018-06-08 13:25:56 -07:00
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
0113035f6d
routing: add new NewPaymentSessionFromRoutes function instead of interface
In this commit, we modify the recent refactoring of the mission control
sub-system to overload the existing payment session, rather than create
a brand new one. This allows us to re-use more of the existing logic, and
also feedback into mission control the failures incurred by any user
selected routes.
2018-06-06 20:45:56 -07:00
Olaoluwa Osuntokun
9f183dc08f
lnrpc: switch REST endpoint for SendToRoute to /v1/channels/transactions/route 2018-06-06 20:45:53 -07:00
t4sk
e4e8b86137 tests: add integration tests for send to route
This commit add 3 integration tests for send-to-route RPC call.
One test ensures that single-hop payments are processed. Another test
checks that payments through a multi-hop route are processed. Lastly,
there is a test to check error propagation while sending payments via fake
predefined route.
2018-06-06 20:45:01 -07:00
t4sk
f4c9192df3 cmd/lncli: add --final_cltv_delta to queryroutes 2018-06-06 20:45:01 -07:00
t4sk
982f53e6f2 rpc: modify QueryRoutes to take final_cltv_delta 2018-06-06 20:45:01 -07:00
t4sk
d6ca581cbc lnrpc: add new final_cltv_delta param to QueryRoutes 2018-06-06 20:45:01 -07:00
t4sk
53eb396ae9 routing/router: add SendToRoute 2018-06-06 20:45:00 -07:00
t4sk
6ddd7b4d0d rpcserver: add SendToRoute methods
rpcserver: add SendToRoute handler
2018-06-06 20:45:00 -07:00
t4sk
dac62e812c lnrpc: add SendToRoute command 2018-06-06 20:45:00 -07:00
t4sk
dc04df0f2e cmd/lncli: add sendtoroute command
This commit adds sendtoroute command to lncli. RPC command SendToRoute
is not yet implemented.
2018-06-06 20:45:00 -07:00
Olaoluwa Osuntokun
e3d1fb0d4b
Merge pull request #1339 from cfromknecht/switch-htlc-satisfies-deadlock
htlcswitch/link: remove deadlock in htlc validation
2018-06-06 18:31:10 -07:00
Conner Fromknecht
c180065a84
htlcswitch/link: remove deadlock in htlc validation
This commit removes a possible deadlock in the switch,
which can be triggered under certain failure conditions.
Previously, we would acquire the link's read lock for
the duration of HtlcSatisfiesPolicy, though we only
need to use it grab the current policy. The deadlock could
be caused in the cases where we attempt to log the failure,
which access the read-protected ShortChanID method.
2018-06-06 18:11:36 -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
077b1fffcc
Revert "rpcserver: flip inbound bool for display, fix internally later"
This reverts commit 5126e431355ea074404064b91c57732e96d0a1e6 since the
underlying issue has now been fixed.
2018-06-06 16:30:41 -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
Olaoluwa Osuntokun
2b2b83f97c
Merge pull request #1335 from halseth/peer-mutex-relaxation
Peer mutex relaxation
2018-06-06 16:29:53 -07:00
Olaoluwa Osuntokun
782fd9d709
Merge pull request #1327 from cfromknecht/waiting-proof-store-external-consistency
channeldb/waitingproof: improve external consistency of store
2018-06-06 15:50:37 -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
Conner Fromknecht
086b44c1f4
channeldb/waitingproof: improve external consistency of store
This commit synchronizes the in-memory cache with the
on-disk state to ensure the waiting proof store is
externally consistent. Currently, there are scenarios
where the in-memory state is updated, and not reverted
if the write fails. The general fix is to wait to apply
modifications until the write succeeds, and use a
read/write lock to synchronize access with db operations.
2018-06-05 21:33:47 -07:00
Olaoluwa Osuntokun
991c9fb7dd
Merge pull request #1332 from Roasbeef/delete-update-index-items
channeldb: ensure items from the update index are actually deleted
2018-06-05 19:34:33 -07:00
Olaoluwa Osuntokun
1d994439e2
Merge pull request #1323 from Roasbeef/accept-duplicate-waiting-proofs
channeldb: don't reject duplicate waiting proofs
2018-06-05 19:20:29 -07:00
Olaoluwa Osuntokun
8f68d0e605
funding+htlcswitch: enforce min fee rate of 253 sat/kw on commitments
In this commit, we add and enforce a min fee rate for commitment
transactions created, and also any updates we propose to the remote
party. It's important to note that this is only a temporary patch, as
nodes can dynamically raise their min fee rate whenever their mempool is
saturated.

Fixes #1330.
2018-06-05 17:50:50 -07:00
Olaoluwa Osuntokun
f9c220cc7b
config: fix bug w/ tor onion services, only disable listen if no v2 or v3 2018-06-05 17:40:48 -07:00
Olaoluwa Osuntokun
dd4cab054d
channeldb: ensure items from the update index are actually deleted
In this commit, we fix an existing bug in the new graph query sync
feature. Before this commit, when a block is pruned, we would never
actually delete the update index entries. This is due to the fact that
we would attempt to delete the entries from the update index _after_ we
had already removed the edges from the update index.

We fix this by simply swapping the order: first we delete from the
update index, then we delete the edges themselves. A test ensuring that
the entires are cleared (which failed before this commit), has been
added.
2018-06-05 17:30:56 -07:00
Olaoluwa Osuntokun
4af9da40c5
htlcswitch: fix alignment in packetQueue for ARM
Fixes #1328.
2018-06-05 12:55:06 -07: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