Commit Graph

11281 Commits

Author SHA1 Message Date
carla
a63640c488
routing: account for payment terminal errors
If we have processed a terminal state while we're pathfinding
for another shard, the payment loop should not error out on
ErrPaymentTerminal. Instead, it would wait for our shards to
complete then cleanly exit.
2021-04-23 08:46:22 +02:00
carla
58d95be4dd
multi: change RegisterAttempt error checking order
Move our more generic terminal check forward so that we only
need to handle a single class of expected errors. This change
is mirrored in our mock, and our reproducing tests are updated
to assert that this move catches both classes of errors we get.
2021-04-23 08:39:45 +02:00
carla
12136a97a9
routing/test: add test for stuck payment with in-flight htlcs
Add an additional stuck-payment case, where our payment gets
a terminal error while it has other htlcs in-flight, and a
shard fails with ErrTerminalPayment. This payment also falls in
our class of expected errors, but is not currently handled. The
mock is updated accordingly, using the same ordering as in our
real RegisterAttempt implementation.
2021-04-23 08:39:45 +02:00
carla
80451afe48
routing/test: add test to demonstrate stuck payment, single shard
This commit adds a test which demonstrates that payments can
get stuck if we receive a payment failure while we're pathfinding
for another shard, then try to dispatch a shard after we've
recorded a permanent failure. It also updates our mock to
only consider payments with no in-flight htlcs as in-flight,
to more closely represent our actual RegisterAttempt.
2021-04-23 08:39:44 +02:00
carla
125980afb7
routing/test: block on pathfinding in tests
This commit adds a step to our payment lifecycle test to add
control over when we find a path for our payment, This is
required for testing race conditions around pathfinding
completing and payment failures being reported.
2021-04-23 08:39:43 +02:00
carla
a68155545c
routing/test: use half shard for single success case
Update our single shard success case to use a route which
splits the payment amount in half. This change still tests
the case where reveal of the preimage counts as a success,
even if we don't have the full amount. This change is made
to cut down on potential races in this test case. While we
are waiting for collectResultAsync to report a success, the
payment lifecycle will continue trying to dispatch shards.
In the case where we send 1/4 of the payment amount, we
send 1 or 2 more shards, depending on how long collectAsync
takes. Reducing this test to send 1/2 of the payment amount
means that we will always only try one more shard before
waiting for our shard.
2021-04-23 08:39:42 +02:00
carla
198d567cb2
routing/test: assert error value for payment failures 2021-04-23 08:39:41 +02:00
carla
e0c52e4473
routing/test: close payment result channel on shutdown, mimicking switch
This commit updates our mock to more closely follow the behavior of the
switch for mocked calls to GetPaymentResult. As it stands, our tests
send a test-created error from the switch when we want to mock shutdown.
In reality, the switch will close its result channel, so we update this
test to follow that behavior. This matters for the commit that follows,
because we start checking the error our payments return. If we have an
error from the switch, our tests will fail with an error that we do
not encounter in practice.
2021-04-23 08:39:40 +02:00
carla
9a78e9da73
routing/tests: move lock acquisition after state driving channels
In our payment lifecycle tests, we have two goroutines that
compete for the lock in our mock control tower: the resumePayment
loop which tries to call RegisterAttempt, and the collectResult
handler which is launched in a goroutine by collectResultAsync
and is responsible for various settle/fail calls.

The order that the lock is acquired by these goroutines is
arbitrary, and can lead to flakes in our tests if the step
that we do not intend to execute first gets the lock (eg,
we want to fail a payment in collectResult, but RegisterAttempt
gets there first). This commit moves contention for this lock
after our mock's various "state driving" channels, so that the
lock will be acquired in the order that the test intends it.
2021-04-23 08:39:39 +02:00
carla
b2d941ebfb
routing/test: remove test channel buffers
Now that we run each test individually, we don't need to buffer
our mock's channels anymore. This helps to tighten our test loop,
which currently can move on from a step before it's actually
been processed by the mock. This removal ensures that our payment
loop processes each of the test's steps before moving on to the
next once.
2021-04-23 08:39:38 +02:00
carla
806c4cbd57
routing/test: run each test case individually, add names
Update our payment lifecycle test to run each test case with
a fresh router. This prevents test cases from interacting with
each other. Names are also added for easy debugging.
2021-04-23 08:39:37 +02:00
carla
cb927e89b0
routing/test: add check that sendpayment completes
As is, we don't check that our SendPayment call in
TestRouterPaymentStateMachine completes. This makes it easier
to create malformed tests that just run through steps but leave
the SendPayment call hanging. This commit adds a check that we
have completed our payment to help catch tests like this. We
also remove an unused quit channel.
2021-04-23 08:39:36 +02:00
Olaoluwa Osuntokun
5a82340a03
Merge pull request #5198 from hsjoberg/sampleconf-tlsdisableautofill
mobile: add tlsdisableautofill to sample config
2021-04-22 15:49:55 -07:00
Olaoluwa Osuntokun
d07202d17b
Merge pull request #5212 from wpaulino/wtclient-update-stats-after-backup
wtclient: decrement pending tasks stats upon accepted task
2021-04-22 15:49:11 -07:00
Olaoluwa Osuntokun
045b58891a
Merge pull request #5146 from ellemouton/context-aware-rpcserver
rpcserver+lnrpc: make Subscribe RPCs context aware
2021-04-22 15:44:00 -07:00
Olaoluwa Osuntokun
5d1574f566
Merge pull request #2522 from roeierez/cleanup_server_error
Cleanup in case of server failed to start
2021-04-22 13:00:22 -07:00
Olaoluwa Osuntokun
bc3c5eb383
Merge pull request #5235 from Roasbeef/btcwallet-simnet-fix
build: update btcwallet to latest version
2021-04-22 12:48:27 -07:00
Olaoluwa Osuntokun
81452a1e1c
build: update btcwallet to latest version
This version includes a fix to a regression that caused simnet wallets
to no longer operate in certain conditions.
2021-04-22 11:20:49 -05:00
Olaoluwa Osuntokun
eda3d45b3d
Merge pull request #5232 from Roasbeef/go-mod-fix
build: set Go version to 1.15 remove retract
2021-04-22 09:15:20 -07:00
whythat
1adeb41a9d rpcserver+lnrpc: make Subscribe RPCs context aware
This commit makes all the Subscribe RCP's context aware so that they
stop executing when the request context is cancelled.
2021-04-22 07:49:29 +02:00
Olaoluwa Osuntokun
2b5c9e1606
build: set Go version to 1.15 remove retract
We need to remove the retract as it's a new directive that isn't
understood by Go versions < 1.16.
2021-04-21 17:44:13 -05:00
Olaoluwa Osuntokun
8f940a5ea3
Merge pull request #5138 from Roasbeef/strict-zombie
channeldb+discovery: implement strict zombie pruning
2021-04-21 14:03:50 -07:00
Olaoluwa Osuntokun
a9f1b341be
discovery: update zombie resurrection test w/ new logic
In this commit, we update the existing zombie resurrection test to
ensure that if we prune an edge and another pubkey is marked as nil,
that we only accept a resurrection channel update from the node the we
originally pruned if the pruning decision was one sided.
2021-04-21 13:56:35 -05:00
Olaoluwa Osuntokun
6c27de7d11
routing: add strict pruning as new flag, default for neutrino
In this commit we add a new flag that controls if lnd will do strict
zombie pruning or not. If true, then this will cause lnd to maintain a
tighter graph as it wants both edges to always be live. We enable this by
default for neutrino as without this, it's possible that a node never
sees both edges begin disabled, so those edges are never actually pruned
from the graph.
2021-04-21 13:56:29 -05:00
Olaoluwa Osuntokun
7b589e5811
routing: add strict zombie pruning as a config level param
In this commit, we add strict zombie pruning as a config level param.
This allow us to add the option for those that want a tighter graph, and
not change the default composition of the channel graph for most users
over night.

In addition, we expand the test case slightly by testing that the self
node won't be pruned, but also that if there's a node with only a single
known stale edge, then both variants will prune that edge.
2021-04-21 13:56:27 -05:00
Olaoluwa Osuntokun
916059da48
routing: update chan pruning test w/ new zombie logic 2021-04-21 13:56:24 -05:00
Conner Fromknecht
e3a8b3b0c4
routing/router: prune zombies when either end is stale 2021-04-21 13:56:21 -05:00
Conner Fromknecht
672dbe39e7
channeldb/graph: only set laggard zombie pubkey 2021-04-21 13:56:19 -05:00
Conner Fromknecht
f28a98aa6f
discovery/gossiper: only parse zombie pubkey if non-empty 2021-04-21 13:56:16 -05:00
Conner Fromknecht
4baee9537b
discovery/gossiper: move zombie handling to helper 2021-04-21 13:56:11 -05:00
Olaoluwa Osuntokun
60250f0a04
Merge pull request #5034 from Roasbeef/m1-go1.16
build: switch all builds systems and CI/ID to go 1.16, update min go version, add support for compiling M1 binaries
2021-04-21 08:59:46 -07:00
Carla Kirk-Cohen
10a15ad73f
Merge pull request #5228 from carlaKC/errlist-neutrinoshutdown
itest: whitelist neutrino shutting down error
2021-04-21 14:04:32 +02:00
Hampus Sjöberg
3826bd735d mobile: add tlsdisableautofill to sample config
This addresses new restrictions in Android 11.
2021-04-21 12:55:46 +02:00
carla
0368da02bd
itest: whitelist neutrino shutting down error 2021-04-21 12:36:43 +02:00
Olaoluwa Osuntokun
1a8d1874a5
Merge pull request #5213 from hsjoberg/mobile-moveup
mobile: Move lndStarted check to the top of the Start function
2021-04-20 09:16:55 -07:00
Hampus Sjöberg
e1ebdb311a mobile: Move lndStarted check to the top of the Start function 2021-04-20 14:51:27 +02:00
Olaoluwa Osuntokun
5c5b91216a
Merge pull request #5221 from Roasbeef/btcwallet-chain-client-alignment
build: update to latest version of btcwallet
2021-04-19 20:15:54 -07:00
Olaoluwa Osuntokun
1301377e1a
build: update to latest version of btcwallet
In this commit, we upgrade to the latest version of `btcwallet` that
fixes an alignment issue with usage of atomics that can cause a panic on
certain systems.

Fixes #5196.
2021-04-16 11:18:01 -07:00
Johan T. Halseth
a36c95f732
Merge pull request #4588 from bjarnemagnussen/coinselect-align-fee-estimates
chanfunding: fee estimation based on change output in `CoinSelect`
2021-04-16 13:43:51 +02:00
Johan T. Halseth
faf5049848
Merge pull request #4599 from hsjoberg/lndmobile-restart
mobile: re-initialize listeners via RecreateListeners
2021-04-15 08:53:55 +02:00
Wilmer Paulino
7517243d6d
wtclient: decrement pending tasks stats upon accepted task
We'd never decrement the number of pending backups upon a watchtower
accepting one, making it confusing for users to determine whether their
backups have actually been accepted. Along the way, we also rename
NumTasksReceived to NumTasksPending to better reflect its purpose.
2021-04-14 17:18:25 -07:00
Conner Fromknecht
748265d097
Merge pull request #5207 from carlaKC/4727-singleinvoice
invoicesrpc: terminate SubscribeSingleInvoice once invoice reaches a final state
2021-04-14 15:32:53 -07:00
Olaoluwa Osuntokun
d5aedbcbd9
Merge pull request #5192 from Roasbeef/reject-cache-chan-ann
discovery: always add chan announcements to the reject cache if err !…
2021-04-14 15:20:18 -07:00
Olaoluwa Osuntokun
bb6aca1130
discovery: add unit tests for chan anns in the reject cache 2021-04-14 15:19:27 -07:00
Olaoluwa Osuntokun
c959ecc4c9
discovery: always add chan announcements to the reject cache if err != ErrIgnored
In this commit, we make a change to always add chan announcements to the
reject cache if we didn't reject them for already existing.  Without
this change, if we end up rejecting a channel announcement say because
the channel is already spent or the funding transaction doesn't exist,
then we'll end up continually re-validating the same set of channels we
know will fail, when they're sent to us by peers.

Fixes #5191
2021-04-14 15:19:14 -07:00
Olaoluwa Osuntokun
54e315101d
Merge pull request #4577 from yyforyongyu/itest-better-logging
itest: logging for subtests and refactor WaitForBlockchainSync
2021-04-14 15:04:34 -07:00
Olaoluwa Osuntokun
70b7c355d3
Merge pull request #4425 from breez/persist-rescan-progress
Persist rescan progress.
2021-04-14 12:43:35 -07:00
Olaoluwa Osuntokun
c760b0188a
Merge pull request #5209 from cfromknecht/constrain-pay-addr-lookup
channeldb/invoice: only allow pay-addr lookup w/ no query hash
2021-04-14 10:10:08 -07:00
carla
db1d671b1a
multi: terminate SubscribeSingleInvoice once completed 2021-04-14 09:19:23 +02:00
carla
0686329062
itest/test: add settle/canceled assertions for subscribe single 2021-04-14 09:19:22 +02:00