Commit Graph

6659 Commits

Author SHA1 Message Date
Wilmer Paulino
c82d73a826
channeldb+routing: extend edge lookup methods with zombie index check
In this commit, we extend the graph's FetchChannelEdgesByID and
HasChannelEdge methods to also check the zombie index whenever the edge
to be looked up doesn't exist within the edge index. We do this to
signal to callers that the edge is known, but only as a zombie, and the
only information that we have about the edge are the node public keys of
the two parties involved in the edge.

In the event that an edge does exist within the zombie index, we make
an additional check on edge policies to ensure they are not within the
router's pruning window, indicating that it is a fresh update.
2019-03-27 13:06:57 -07:00
Wilmer Paulino
e98f4d6d9d
channeldb: extend DeleteChannelEdge to mark edge as zombie
We mark the edges as zombies when pruning them to ensure we don't
attempt to reprocess them later on. This also applies to channels that
have been removed from the graph due to being stale.
2019-03-27 13:06:34 -07:00
Wilmer Paulino
b780dfacdb
channeldb: add zombie edge index
In this commit, we add a zombie edge index to the database. This allows
us to quickly determine across restarts whether we're attempting to
process an edge we've previously deemed as zombie.
2019-03-27 13:06:12 -07:00
Wilmer Paulino
a26a643273
channeldb: remove unused buckets 2019-03-27 13:05:48 -07:00
Johan T. Halseth
ec70965c8a
Merge pull request #2824 from wpaulino/chanid-openchannel
rpcserver: retrieve Channel ChanId from OpenChannel record
2019-03-27 15:29:46 +01:00
Johan T. Halseth
59e3390f6c
Merge pull request #2750 from cryptagoras/patch-1
htlcswitch/switch: log target node on insufficient cap error
2019-03-27 15:10:08 +01:00
Johan T. Halseth
4d8100cc9a
Merge pull request #2640 from joostjager/cltv-limit
routing: add cltv limit
2019-03-27 10:05:02 +01:00
Olaoluwa Osuntokun
d736454599
Merge pull request #2831 from philippgille/patch-3
docs/MAKEFILE: Remove mention of dep and Glide
2019-03-26 20:54:38 -07:00
Olaoluwa Osuntokun
6d3f0551b5
Merge pull request #2828 from philippgille/patch-2
docs: fix typo
2019-03-26 20:53:41 -07:00
Olaoluwa Osuntokun
07c0dbb199
Merge pull request #2806 from wpaulino/txnotifier-hint-logs
chainntnfs: fix RegisterSpend height hint logs
2019-03-26 20:53:01 -07:00
Olaoluwa Osuntokun
b935f69a6e
Merge pull request #2819 from cfromknecht/peer-write-retry
peer: catch write timeouts, retry with backoff
2019-03-26 18:44:30 -07:00
Wilmer Paulino
bde417e2ef
chainntnfs: fix RegisterSpend and RegisterConf height hint logs 2019-03-26 18:13:02 -07:00
Conner Fromknecht
c5365160fb
server: wrap peer connection tiebreaking to 80 chars 2019-03-26 16:41:30 -07:00
Conner Fromknecht
7358535725
peer+server: log pubkey@addr 2019-03-26 16:41:13 -07:00
Conner Fromknecht
60467bef7b
lncfg/workers: bump default read/write workers from 16 -> 100
Bumps the default read and write handlers to be well
above the average number of peers a node has. Since
the worker counts specify only a maximum number of
concurrent read/write workers, it is expected that
the actual usage would converge to the requirements
of the node anyway. However, in preparation for a
major release, this is a conservative measure to
ensure that the default values aren't too low and
improve network instability.
2019-03-26 16:40:57 -07:00
Conner Fromknecht
93e56f9ee8
peer: add symmetric write idle timeout
In this commit, we add a 5 minute idle timer to
the write handler. After catching the write
timeouts, it's been observed that some connections
have trouble reading a message for several hours.
This typically points to a deeper issue w/ the peer
or, e.g. the remote peer switched networks. This now
mirrors the idle timeout used in the read handler,
such that we will disconnect a peer if we are unable
to send or receive a message from the peer after 5
minutes.

We also modify the readHandler to drain its
idleTimer's channel in the even that the timer had
already fired, but we successfully sent the message.
2019-03-26 16:40:41 -07:00
Conner Fromknecht
b78e5f6742
peer: reduce write timeout to 5 seconds
This commit reduces the peer's write timeout to 5s.
Now that the peer catches write timeouts and doesn't
disconnect, this will ensure we spend less time blocking
in the write pool in case others also need to access the
workers concurrently. Slower peers will now only block
for 5s, after every reattempt w/ exponential backoff.
2019-03-26 16:40:24 -07:00
Conner Fromknecht
99150b41d6
peer: retry writes with delay on timeout errors
This commit modifies the writeHandler to catch timeout
errors, and retry writes to the socket after a small
backoff, which increases exponentially from 5s to 1m.
With the growing channel graph size, some lower-powered
devices can be slow to pull messages off the wire during
validation. The current behavior will cause us to
disconnect the peer, and resend all of the messages that
the remote peer is slow to validate. Catching the timeout
helps in preventing such expensive reconnection cycles,
especially as the network continues to grow.

This is also a preliminary step to reducing the
write timeout constant. This will allow concurrent usage
of the write pools w/out devoting excessive amounts of
time blocking the pool for slow peers.
2019-03-26 16:40:07 -07:00
Olaoluwa Osuntokun
1a8e4b0316
Merge pull request #2058 from roeierez/fix_reconnect
Reconnect to peer when switching networks
2019-03-26 16:13:21 -07:00
cryptagoras
a50428ca96 htlcswitch/switch: log target node on insufficient cap error 2019-03-25 18:25:58 +02:00
Philipp Gillé
449707d90a
docs/MAKEFILE: Remove mention of dep and Glide
Commit ca28c0b removed the dep section,
so it shouldn't be mentioned as a target in other targets.
Also, Glide doesn't seem to be used anymore as well.
2019-03-24 13:28:51 +01:00
Philipp Gillé
8b568296df
docs: fix typo 2019-03-23 17:03:40 +01:00
Olaoluwa Osuntokun
6ad8be25e1
Merge pull request #2773 from Roasbeef/graph-batch
channeldb: convert all Update calls to use Batch
2019-03-22 15:05:28 -07:00
Wilmer Paulino
c0977c95df
rpcserver: retrieve Channel ChanId from OpenChannel record
This is a better alternative than retrieving it from the graph as it's
possible that the channel is pruned from it doing to not having any
updates within the past two weeks.
2019-03-22 12:25:31 -07:00
Olaoluwa Osuntokun
c7ca387a9d
Merge pull request #2744 from cfromknecht/disable-before-close
cnct+chancloser: disable channel before closing
2019-03-21 21:08:23 -07:00
Olaoluwa Osuntokun
e58fa33ab0
Merge pull request #2590 from Crypt-iQ/init_message_payload_fix
lnwire: features "maxAllowedSize" fix
2019-03-21 20:58:29 -07:00
Olaoluwa Osuntokun
6440f39120
Merge pull request #2794 from halseth/autopilot-query-heuristic-no-active-agent
autopilot: move queryHeuristic out of agent
2019-03-21 20:20:51 -07:00
Olaoluwa Osuntokun
5ee40df54c
Merge pull request #2765 from cfromknecht/brar-handle-tower-sweep
breacharbiter: watch for spends on all inputs until reaching terminal states
2019-03-21 20:10:24 -07:00
Olaoluwa Osuntokun
15c9b389fa
Merge pull request #2781 from joostjager/fix-routerrpc
routerrpc: adapt to changed interfaces of routing subsystem
2019-03-21 19:28:26 -07:00
Olaoluwa Osuntokun
9fc4335ba0
Merge pull request #2790 from alexbosworth/patch-11
README: remove testnet3 specificity
2019-03-21 16:07:07 -07:00
Joost Jager
73efc31177
build: add routerrpc tag in itest 2019-03-21 10:25:58 +01:00
Joost Jager
087de7cc4d
routerrpc: adapt to changed interfaces of routing subsystem 2019-03-21 10:25:55 +01:00
Olaoluwa Osuntokun
9f6a1403e9
Merge pull request #2804 from Roasbeef/update-btcwallet-itest-deadlock
build: update btcwallet to version with deadlock fix
2019-03-20 20:29:27 -07:00
Olaoluwa Osuntokun
8e3a8f2d01
watchtower/wtclient: fix linter issue 2019-03-20 19:36:59 -07:00
Olaoluwa Osuntokun
c48790ff89 build: update to latest btcwallet with deadlock bug fix, neutrino bump 2019-03-20 19:36:50 -07:00
Olaoluwa Osuntokun
9143067014
Merge pull request #2779 from cfromknecht/wtserver-delete-session
watchtower/wtserver: add DeleteSession request
2019-03-19 22:01:17 -07:00
Conner Fromknecht
0c519778a1
watchtower/wtserver/server_test: add TestServerDeleteSession 2019-03-19 19:41:17 -07:00
Conner Fromknecht
3564406dc1
watchtower/wtserver/server_test: cleanup test framework, remove test case indexes 2019-03-19 19:38:57 -07:00
Conner Fromknecht
26adf735c4
watchtower/wtserver: add DeleteSession handler 2019-03-19 19:38:46 -07:00
Conner Fromknecht
8e4a20e1a5
watchtower/wtserver/interface: add DeleteSession + mock impl 2019-03-19 19:38:34 -07:00
Conner Fromknecht
25b2a352cb
watchtower/wtserver: refactor server handlers into own files 2019-03-19 19:38:20 -07:00
Conner Fromknecht
3d934d0978
watchtower/wtwire: add DeleteSession and DeleteSessionReply message 2019-03-19 19:38:09 -07:00
Conner Fromknecht
9523b420bc
breacharbiter_test: add table-driven breach spend tests 2019-03-19 19:25:57 -07:00
Conner Fromknecht
6f06c30421
mock: support late registration of spend ntfns 2019-03-19 19:22:47 -07:00
Conner Fromknecht
997aa3ecf0
breacharbiter: detect all spends, add terminal states
This commit modifies the breach arbiter to monitor
all breached inputs for spends and remove them from
the set of inputs to be swept if they are spent to
a terminal state. Prior, we would only watch for
spends on htlcs that may need to transition and
sweep the corresponding second-level htlc.

With these changes, we will no monitor commitment
outputs for spends, as well as spends from the
second level htlcs themselves. If either of these
is detected, we remove them from the set of inputs
to sweep via the justice transaction because there
is nothing the breach arbiter can do.

This functionality will be needed when adding
watchtower support, as the breach arbiter must
detect the case when the tower sweeps on behalf of
the user and stop pursuing the sweep itself. In
addition, this now properly handles the potential
case where somehow the remote party is able to sweep
the their commitment or second-level htlc to their
wallet, and prevent the breach arbiter from trying
to sweep the outputs as it would now.

Note that in the latter event, the internal
accounting may still be incorrect, as it is assumed
that all breached funds return to the victim.
However, these issues will deferred and fixed at a
later date, as the more crucial aspect is that the
breach arbiter doesn't blow up as a result of towers
sweeping channels.
2019-03-19 19:22:35 -07:00
Conner Fromknecht
3641beb002
breacharbiter: capitalize "unable to" error msgs 2019-03-19 19:21:03 -07:00
Olaoluwa Osuntokun
6d3b142f2a
Merge pull request #2800 from Roasbeef/simplify-timeout-resolver
contractcourt: simplify htlcTimeoutResolver
2019-03-19 17:27:24 -07:00
Olaoluwa Osuntokun
da76c34418
channeldb: convert invoice settle/cancel calls to use Batch 2019-03-19 17:11:17 -07:00
Olaoluwa Osuntokun
e8da6dd0b4
channeldb: convert concurrent channel state machine calls to use Batch 2019-03-19 17:11:14 -07:00
Olaoluwa Osuntokun
3555d3dbd4 channeldb: convert all Update calls to use Batch
In this commit, we convert all the `Update` calls which are serial, to
use `Batch` calls which are optimistically batched together for
concurrent writers. This should increase performance slightly during the
initial graph sync, and also updates at tip as we can coalesce more of
these individual transactions into a single transaction.
2019-03-19 17:10:46 -07:00