Commit Graph

6858 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
5d68f0f9eb
htlcswitch: only perform CLTV checks for HTLCs with open invoices
In this commit, we fix a bug that would cause a node with a hodl HTLC to
cancel back the HTLC upon restart if the invoice has been settled, but
the HTLC is still present on the commitment transaction. A fix for the
HTLC still being present (not triggering a new commitment) has been
fixed recently. However, for older nodes with a lingering HTLC, on
restart it would be failed back.

In this commit, we make the check stricter by only performing these
checks for HTLCs that are in the open state. This ensures that we'll
only check this constraints the first time around, before the HTLC has
been transitioned to the accepted state.
2019-04-11 17:53:25 -07:00
Olaoluwa Osuntokun
f9a08044dc
release: update release build to include select sub-servers 2019-04-11 16:04:42 -07:00
Olaoluwa Osuntokun
d817b8c9db
server: remove duplicate HistoricalSyncTicker param 2019-04-11 16:01:17 -07:00
Conner Fromknecht
5b3170d542 lnd_test: apply AsyncBenchmarkTimeout to async_payments_benchmark
It was mistakenly only applied to async_bidirectional_payments, which
can also see timeouts due to darwin fsync performance regression.
2019-04-11 15:54:21 -07:00
Olaoluwa Osuntokun
b089eb8c83
Merge pull request #2928 from philippgille/feature/update-go-version
Update Go version from 1.11 to 1.12
2019-04-11 15:51:47 -07:00
Olaoluwa Osuntokun
a8c6d03fae
Merge pull request #2929 from cfromknecht/delay-restored-chan-reestablish
htlcswitch/link: delay restored channel reestablish
2019-04-11 15:50:07 -07:00
Wilmer Paulino
4bb4b0fe4e discovery: increase DefaultHistoricalSyncInterval to one hour
Assuming a graph size of 50,000 channels, an interval of 20 minutes
would cause nodes to consume about 600MB per month in bandwidth doing
these routine historical sync spot checks. In this commit, we increase
to one hour, which consumes about 300MB per month.
2019-04-11 15:46:22 -07:00
Wilmer Paulino
be727ab0be config+server: expose HistoricalSyncInterval flag
This allows us to set how often the daemon should routinely perform
historical graph syncs.
2019-04-11 15:45:19 -07:00
Conner Fromknecht
057bed2b92
htlcswitch/link: delay restored channel reestablish
This commit adds a brief delay when sending our channel reestablish
message if the link contains a restored channel to ensure we first have
a stable connection. Sending the message will cause the remote peer to
force close the channel, which currently may not be resumed reliably if
the connection is being torn town simultaneously. This delay can be
removed after the force close is reliable, but in the meantime it
improves the reliability of successfully closing out the channel and
allows the `channel_backup_restore/restore_during_creation` to pass
reliably.
2019-04-11 15:42:02 -07:00
Olaoluwa Osuntokun
6963a92950
Merge pull request #2931 from cfromknecht/channel-backup-flake
lnd_test: use WaitNoError when testing num singles in...
2019-04-11 15:39:36 -07:00
Olaoluwa Osuntokun
bc425b1a77
Merge pull request #2918 from joostjager/hodl-drop-fix
htlcswitch: ensure commit tx gets updated after settle hodl invoice
2019-04-11 15:38:56 -07:00
Olaoluwa Osuntokun
7a0c9f33bc
Merge pull request #2923 from Roasbeef/scb-peer-fixes
multi: peer related SCB fixes
2019-04-10 21:33:26 -07:00
Conner Fromknecht
f19a6a0ba2
lnd_test: use WaitNoError when testing num singles in...
export_channel_backup. Fixes a local flake hit reliably on darwin.
2019-04-10 19:23:08 -07:00
Olaoluwa Osuntokun
7b0a31217f
chanrestore: ensure we have no existing connections to recovery peer
In this commit, we fix a slight bug in the existing implantation that
would cause no channel recovery if the recovering node was already
connected to their channel peer. As we need the link to be known at the
time of connection, if we're already connected, then the chan sync
message won't be sent again. By first disconnecting an existing peer, we
ensure that during the next connection (after the recovered channel is
added to the database), then the regular chan sync message exchange will
take place as expected.  # Please enter the commit message for your
changes.
2019-04-10 18:01:54 -07:00
Olaoluwa Osuntokun
5ac9ba6472
htlcswitch: synchronously send the chan sync message to the remote peer
In this commit, we modify the starting link logic to always send the
chan sync message to the remote peer in a synchronous manner. Otherwise,
it's possible that we fail very quickly below this block, and don't ever
send the message to the remote peer.
2019-04-10 18:01:52 -07:00
Olaoluwa Osuntokun
71e080a2fb
chanrestore: don't exit with an error if we're already connected to the peer
In this commit, we fix a bug in the existing logic for ConnectPeer that
would cause an SCB restore to fail if we were already connected to the
peer. To fix this, we now instead will just return with a success if
we're already connected to the peer.
2019-04-10 18:01:51 -07:00
Olaoluwa Osuntokun
c0d2ffc87e
Merge pull request #2917 from Roasbeef/private-chan-updates
discovery: don't send private chan updates to wider network
2019-04-10 17:58:40 -07:00
Olaoluwa Osuntokun
4b57fb199f server: add new errPeerAlreadyConnected error type 2019-04-10 17:27:58 -07:00
Olaoluwa Osuntokun
58aa32035c
Merge pull request #2921 from cfromknecht/skip-unknown-edges
channeldb/graph: skip unknown edges in FetchChanInfos
2019-04-10 17:18:13 -07:00
Olaoluwa Osuntokun
de621246a9
Merge pull request #2925 from halseth/newaddress-log-level
[trivial] rpcserver: demote newaddress log to debug, log addr type
2019-04-10 17:07:22 -07:00
Olaoluwa Osuntokun
53beed7aaf
discovery: send policy updates for private channels directly to the remote peer
In this commit, we modify the main loop in `processChanPolicyUpdate` to
send updates for private channels directly to the remote peer via the
reliable message sender. This fixes a prior issue where the remote peer
wouldn't receive new updates as this method doesn't go through the
traditional path for channel updates.
2019-04-10 17:05:51 -07:00
Olaoluwa Osuntokun
a9d6273828
discovery: add new TestPropagateChanPolicyUpdate test case
In this commit, we add a new test case to exercise a recent bug fix to
ensure that we no longer broadcast private channel policy changes. Along
the way, a few helper functions were added to slim down the test to the
core logic compared to some of the existing tests in this package. In
the future, these new helper functions should be utilized more widely for
tests in this package in order to cut down on some of the duplicated
logic.
2019-04-10 17:05:49 -07:00
Olaoluwa Osuntokun
a6ae397f8c
discovery: ensure we don't broadcast policy changes for private channels 2019-04-10 17:05:48 -07:00
Olaoluwa Osuntokun
921eea9f57
discovery: update mockGraphSource to implement ForAllOutgoingChannels 2019-04-10 17:05:47 -07:00
Olaoluwa Osuntokun
aba32de1f4
discovery: set AnnSigner for mock signer in testCtx 2019-04-10 17:05:44 -07:00
Olaoluwa Osuntokun
13b91e6ea1 discovery: properly set short chan IDs for ann sigs in tests 2019-04-10 17:05:37 -07:00
Joost Jager
72c86fbf5d
htlcswitch/test: test revocation window exhaustion 2019-04-10 21:30:31 +02:00
Philipp Gille
c99c1f59f3 docs: update Go version from 1.11 to 1.12
- Also changed "go" to "Go" when used as a name
- Also changed "http" to "https" for two URLs that support HTTPS
2019-04-10 21:15:18 +02:00
Philipp Gille
31602026db docker: update Go version from 1.11 to 1.12 2019-04-10 21:13:11 +02:00
Joost Jager
6d2dfed03d
htlcswitch: increase batch counter for exit hop settle and fail
The idea of the batch counter is to increase it for commit tx updates,
so that if the commit tx cannot be updated immediately (revocation
window exhausted), the batch ticker makes sure it happens later.

The batch counter was increased for forwarded htlcs, but not for exit hop
resolutions.

This lead to the situation where the commitment tx would not be updated,
even though the htlc was settled locally. When no other changes happen
on the channel, the htlc eventually reaches its expiry and the channel
is force closed.
2019-04-10 21:04:51 +02:00
Johan T. Halseth
0310d8f2b4
rpcserver: demote newaddress log to debug, log addr type 2019-04-10 09:08:36 +02:00
Conner Fromknecht
f82b7c9bac
channeldb/graph: remove MarkEdgeZombie
This commit removes the MarkEdgeZombie method from channeldb. This
method is currently not used in any live code paths in production, and
is only used in unit tests. However, incorrect usage of this method
could result in an edge being present in both the zombie and channel
indexes, which deviates from any state we would expect to see in
production. Removing the method will help mitigate the potential for
writing incorrect unit tests in the future, by forcing zombie edges to
be created via the relevant, production APIs, e.g. DeleteChannelEdge.

The existing unit tests that use this method have been modified to use
the DeleteChannelEdge instead. No regressions were discovered in the
process.
2019-04-09 22:12:02 -07:00
Olaoluwa Osuntokun
81bfebe7be
Merge pull request #2898 from Roasbeef/neutrino-ban-duration
lnd: increase neutrino ban duration to 48hrs from 5s
2019-04-09 21:51:08 -07:00
Olaoluwa Osuntokun
66754b6e71
build: update to latest btcd with connmgr bug fix 2019-04-09 19:56:25 -07:00
Olaoluwa Osuntokun
3e5a6f1022
Merge pull request #2905 from cfromknecht/split-chunk-size
discovery: make batch size distinct from chunk size, reduce to 500
2019-04-09 19:27:20 -07:00
Conner Fromknecht
4a755435e6
channeldb/graph: skip unknown edges in FetchChanInfos
This commit modifies FetchChanInfos to skip any channels that are not in
the graph at the time of the call. Currently the entire call will fail
if the edge is not found, which stalls a gossip sync in the following
scenario:

 1. Remote peer queries for a channel range
 2. We return the set of channel ids in that range
 3. A channel from that set is removed from the graph, e.g. via close.
 4. Remote peer queries for removed edge, causing the query to fail.

To remedy this, we will now skip any edges that are not known in the
database at the time of the query. This prevents the syncer state
machines from halting, which otherwise could only be resolved by
disconnecting and reconnecting.
2019-04-09 17:35:58 -07:00
Joost Jager
a2aeb646e7
Merge pull request #2908 from joostjager/chan-arb-logging
cnct+invoices: improve logging
2019-04-09 22:34:12 +02:00
Johan T. Halseth
2782baf793
Merge pull request #2910 from halseth/neutrino-chainservice-stoporder
chainregistry: stop Neutrino before closing DB
2019-04-09 09:49:32 +02:00
Olaoluwa Osuntokun
78ffb5bb5f
Merge pull request #2915 from joostjager/hodl-restart-quick-fix
htlcswitch: do not check final cltv for accepted invoices
2019-04-08 13:37:58 -07:00
Joost Jager
038ce342b3
htlcswitch: do not check final cltv for accepted invoices 2019-04-08 18:16:21 +02:00
Joost Jager
33a1904dc9
invoices: unify invoice log statements 2019-04-08 13:10:51 +02:00
Johan T. Halseth
9cc0ea93b2
chainregistry: stop Neutrino before closing DB
To avoid the ChainService still attempting to access the database when
it gets closed, re-order the stop order such that the Chainservice gets
stopped before closing the DB.
2019-04-08 12:48:51 +02:00
Johan T. Halseth
9e67f25957
chainregistry: only stop ChainService after successful start 2019-04-08 12:48:42 +02:00
Joost Jager
86eb0a3383
cnct: log go to chain reason
This commit adds logging of the reason to go to chain for a channel.
This can help users to find out the reason why a channels forced closed.

To get all go to chain reasons, an optimization to break early is
removed. This optimization was not significant, because the normal flow
already examined all htlcs. In the exceptional case where we need to go
to chain, it does not weigh up against logging all go to chain reasons.
2019-04-08 10:34:41 +02:00
Olaoluwa Osuntokun
1fea5b09b2
Merge pull request #2902 from cfromknecht/restore-lazy-gossip-query
discovery/sync_manager: restore lazy gossip sends
2019-04-06 18:05:11 -07:00
Conner Fromknecht
a4b4fe666a
discovery: make batch size distinct from chunk size, reduce to 500
This commit reduces the number of channels a syncer will request from
the remote node in a single QueryShortChanIDs message. The current size
is derived from the chunkSize, which is meant to signal the maximum
number of short chan ids that can fit in a single ReplyChannelRange
message. For EncodingSortedPlain, this number is 8000, and we use the
same number to dictate the size of the batch from the remote peer.

We modify this by introducing a separately configurable batchSize, so
that both can be tuned independently. The value is chosen to reduce the
amount of buffering the remote party will perform, only requiring them
queue 500 responses, as opposed to 8000. In turn, this reduces larges
spikes in allocation on the remote node at the expense of a few extra
round trips for the control messages. However, will be negligible since
the control messages are much smaller than the messages being returned.
2019-04-06 15:27:26 -07:00
Conner Fromknecht
9df6af237e
discovery/sync_manager: restore lazy gossip sends 2019-04-06 03:32:03 -07:00
Olaoluwa Osuntokun
66189f1a21
lnd: increase neutrino ban duration to 48hrs from 5s
In this commit, we fix an oversight that overrode the default ban
duration for neutrino to 5s from the default 24 hrs. We correct this by
raising the ban duration to 48hrs. In the future in order to ignore
these peers persistently, we'll need to start to persist our ban list.
However that's a change for another time.
2019-04-05 16:07:54 -07:00
Wilmer Paulino
73791e15a1
Merge pull request #2830 from philippgille/feature/update-contribution-checklist
docs: update contribution checklist
2019-04-05 15:46:34 -07:00
Conner Fromknecht
25d2b1b537
Merge pull request #2885 from cfromknecht/stagger-initial-reconnect
server: stagger initial reconnects
2019-04-05 15:46:12 -07:00