Commit Graph

130 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
67e18e6089
rpc: optimize DescribeGraph by caching the response
Unfortunately, we can't use the graph cache directly here as it doesn't
include all the information we need, since it only includes the minimal
amount of information needed for path finding.

Instead, we use a simple mutex guarded cache that evicts itself after a
certain interval. The default is set small enough that most users
shouldn't really notice. We also provide a way to disable the cache, and
also disable the cache in the itests.

Fixes https://github.com/lightningnetwork/lnd/issues/1232
2021-11-04 15:30:31 -07:00
Oliver Gugger
0fac6c400e
itest: wait for node to fully start up 2021-10-06 16:29:49 +02:00
Oliver Gugger
c89637a4e2
itest: fix close of closed channel panic 2021-10-05 20:48:48 +02:00
Oliver Gugger
98061dfd58
mod+lntest: disable stall handler in btcd mining node
The latest version of btcd allows its stall handler to be disabled. We
use that new config option to make sure the mining btcd node and the lnd
chain backend btcd node aren't disconnected if some test takes too long
and no new p2p messages are exchanged.
2021-10-05 20:48:47 +02:00
Joost Jager
daeb96fe0a
postgres: add itest 2021-09-21 10:44:23 +02:00
Oliver Gugger
4b43e977b2
lntest: add RPC middleware itests 2021-09-20 17:04:39 +02:00
Oliver Gugger
045765111a
multi: use safe copy for macaroons
Fixes #4383 by adding a new SafeCopyMacaroon function that correctly
clones all caveats and prevents modifications on the copy from affecting
the original.
2021-09-20 13:05:46 +02:00
yyforyongyu
87c13d31b4
itest: watch channel policy updates in harness node 2021-09-17 07:50:43 +08:00
yyforyongyu
d2277ac915
itest: replace chanOpen bool with chanWatchType 2021-09-17 07:50:42 +08:00
yyforyongyu
a58543d1c7
itest: remove extra graph topology subscription 2021-09-17 07:50:42 +08:00
yyforyongyu
92cd6657c5
lntest: refactor handle close channel update 2021-09-17 07:50:42 +08:00
yyforyongyu
0701834a5d
lntest: refactor handle update open channel 2021-09-17 07:50:42 +08:00
yyforyongyu
a1024163fe
itest: add more verbose log and print node state 2021-09-17 07:50:42 +08:00
yyforyongyu
c4913e6f4a
itest: require server being started when creating node
We now require the lnd to be fully started when creating a new node
using newNode.
2021-09-14 07:34:10 +08:00
Andras Banki-Horvath
9bf04f9870
itest+etcd: save etcd logs along the node logs 2021-09-10 14:40:57 +02:00
ErikEk
ca7192f8fd itest: include compressed btcd backend logs 2021-08-24 02:00:44 +02:00
Stevie Zollo
00f7534e06
docs: fix inconsistent naming of channel.backup [skip ci] 2021-08-12 00:26:53 +02:00
Oliver Gugger
5cabd980b1
lntest: make it clear that profile failure is follow-up error
From the error in the itest output log it is not clear whether scraping
the profile page caused a test to fail or whether it was just a
follow-up error. We make it a bit more clear with an added message.
2021-08-05 16:11:28 +02:00
Olaoluwa Osuntokun
945c0fa0df
Merge pull request #5521 from Roasbeef/amp-test-flake-chan-open
lntest: fix possible race condition re asserting channel propagation
2021-08-04 19:21:03 -07:00
Oliver Gugger
66ed64da48
lntest: fix timing related flakes 2021-08-04 19:42:13 +02:00
Olaoluwa Osuntokun
6cd981420a
lntest: fix possible race condition re asserting channel propagation
In this commit, we attempt to fix a race condition that may occur in the
current AMP and MPP tests.

It appears the following scenario is possible:
  * The `mppTestContext` [is used to create 6 channels back to
    back](https://github.com/lightningnetwork/lnd/blob/master/lntest/itest/lnd_amp_test.go#L43)
  * The method used to create the channel ends up calling
    [`openChannelAndAssert`](edd4152682/lntest/itest/lnd_mpp_test.go (L300))
    which'll open the channel, mine 6 blocks, [then ensure that the
    channel gets
    advertised](edd4152682/lntest/itest/assertions.go (L78))
  * Later on, [we wait for all nodes to hear about all channels on the
    network
    level](https://github.com/lightningnetwork/lnd/blob/master/lntest/itest/lnd_amp_test.go#L62)

I think the issue here is that we'll potentially already have mined 30
or so blocks before getting to the final nodes, and those nodes may have
already heard about the channel already. This may then cause their
[`lightningNetworkWatcher`](edd4152682/lntest/node.go (L1213))
goroutine to not properly dispatch this, since it's assumed that the
channel hasn't been announced (or notified) when the method is called.

One solution here is to just check if the channel is already in the
node's graph or not, when we go to register the notification. If we do
this in the same state machine as the watcher, then we ensure if the
channel is already known, the client is immediately notified. One thing
that can help us debug this more in the future is adding additional
logging in some of these helper goroutines so we can more easily track
the control flow.

This commit implements this solution by checking to ensure that the
channel isn't already known in our channel graph before attempting to
wait for its notification, as we may already have missed the
notification before this registration request came in.
2021-07-14 20:12:00 -07:00
Joost Jager
98e75b486d
itest: add db backend flag 2021-07-05 10:10:02 +02:00
Joost Jager
387f1ef274
lntest: abstract db backup and restore 2021-07-05 09:20:19 +02:00
Olaoluwa Osuntokun
5bd84e2a60
lntest: retry node shutdown attempts to recovery tests
In #5364 we added a new error path in the `StopDaemon` method to return
an error if shutdown was attempted while a rescan/recover instance was
in progress. Since the wallet actually won't fully stop (atm)
mid-recovery, the call effectively didn't do anything in that scenario,
so we started to return an error to properly reflect that. However this
causes certain itests to fail, as during recovery, the stop attempt will
fail leading to the test itself failing.

In this commit, we wrap the calls to stop a running daemon within a
`wait.NoError` call so we'll continually try to shut down the daemon
rather than quit on the first try.

Fixes #5423.
2021-06-24 15:37:32 -07:00
Oliver Gugger
e39d00900c
Merge pull request #5260 from guggero/windows-itest
Travis: fix Windows itest
2021-05-14 12:57:51 +02:00
Oliver Gugger
e4873ac878
lntest: re-use P2P ports during SCB recovery
In some rare instances it can happen that the nodes don't find each
other again after one of them has been re-created and the other one has
been restarted in the SCB tests. By making sure the re-created has the
same P2P port again as before, we make sure they can connect to each
other again successfully for executing DLP.
2021-05-14 10:59:10 +02:00
Conner Fromknecht
2ecd1de713
config: expose distinct accept-amp flag
This mirrors the accept-keysend flag, but also permits users to
eventually toggle off keysend separately from AMP.
2021-05-10 22:02:15 -07:00
Andras Banki-Horvath
7caf26ce94
itest: add itest for failover after forcefull shutdown 2021-05-04 17:33:12 +02:00
Andras Banki-Horvath
5d8488871c
itest: basic failover itest when using leader election on etcd 2021-05-04 17:33:12 +02:00
Andras Banki-Horvath
5e215a7a66
lnrpc: add "waiting to start" state to state service
This commit adds a new "waiting to start" state which may be used to
query if we're still waiting to become the cluster leader. Once leader
we advance the state to "wallet not exist" or "wallet locked" given
wallet availablity.
2021-05-04 17:33:11 +02:00
yyforyongyu
96c3a64316
lntest: refactor WaitForBlockchainSync 2021-04-14 12:30:22 +08:00
Wilmer Paulino
983f402369
itest: add wallet import cases 2021-04-05 15:41:12 -07:00
Johan T. Halseth
5e9e03858d
lntest/node: call FetchNode info in wait.NoError after init
In case we call it before the RPC server is fully active.
2021-03-11 13:05:24 +01:00
Wilmer Paulino
d4fa430ca6
Revert "lntest: always turn off gossip throttling for nodes created in itests"
This reverts commit 447c9f2c0b.
2021-02-10 15:45:47 -08:00
Andras Banki-Horvath
b2ab5e8af1
itests: run etcd itests with generated ports 2021-01-08 15:39:12 +01:00
Oliver Gugger
cdcbc0376d
lntest: replace hard coded timeouts
This commit replaces most of the hard coded 10, 15, 20 and 30 second
timeouts with the default timeout. This should allow darwin users to
successfully run the parallel itests locally as well.
2020-12-08 21:37:12 +01:00
Oliver Gugger
36756c012d
lntest: use nextAvailablePort for miner and btcd backend
With the new btcd version we can specify our own listen address
generator function for any btcd nodes. This should reduce flakiness as
the previous way of getting a free port was based on just picking a
random number which lead to conflicts.
We also double the default values for connection retries and timeouts,
effectively waiting up to 4 seconds in total now.
2020-12-03 11:30:23 +01:00
Oliver Gugger
2edc3cf98f
multi: update to latest btcd version
With this commit we update btcd to the latest version which allows us to
specify the btcd binary we want to use when spinning up a new node.
2020-12-03 11:30:22 +01:00
Olaoluwa Osuntokun
447c9f2c0b
lntest: always turn off gossip throttling for nodes created in itests 2020-11-30 16:39:06 -08:00
Conner Fromknecht
82a238317c
lncfg+itest: expose configurable batch-commit-interval
This will permit a greater degree of tuning or customization depending
on various hardware/environmental factors.
2020-11-25 16:45:25 -08:00
Andras Banki-Horvath
369ae5e372
itest: move all test db files when using both etcd and bbolt
In some tests we moved channeld.db to a temp location in order to
"time travel". This commit extends the existing semantics by moving all
files, including embedded etcd db too besides the channeld.db file.
2020-11-18 15:34:45 +01:00
Andras Banki-Horvath
98342433ab
itest: add etcd flag to control if new lnd nodes should run on etcd 2020-11-18 15:34:44 +01:00
Andras Banki-Horvath
979c8497b2
itest: add icase to node log filename + restart nodes before each icase
This commit adds the icase name to the log filename, to make it simpler
to find problematic tests. Additionally after this commit we'll restart
Alice and Bob (the base harness nodes) before each icase to start with a
clean state.
2020-11-12 09:17:52 +01:00
Oliver Gugger
24adf475ce
lnd_test: add integration tests for stateless init 2020-11-07 11:24:35 +01:00
Oliver Gugger
f358a4474d
lntest: add log dir flag 2020-11-04 11:03:30 +01:00
Oliver Gugger
a50d337e42
lntest: lower initial port, add ApplyPortOffset function
To allow running multiple test tranches in parallel, we need a way to
make sure the TCP ports don't collide. We'll work with offsets for the
ports, using a different offset for each tranche.
2020-11-04 11:03:25 +01:00
yyforyongyu
310f87e271
itest: save temp miner's logs 2020-10-02 00:04:47 +08:00
yyforyongyu
d2d71476bd
lntest: init SignerClient and test DeriveSharedKey 2020-09-17 14:52:36 +08:00
Joost Jager
b6ebf3f27d
lntest: use web fee estimator in itests 2020-09-16 08:17:34 +02:00
Matheus Degiovani
91538884da lntest: wait for valid tls cert and macaroon files
This changes the wait during node connection to check both for the
existance as well as for the validity of the tls cert and macaroon
files.

This ensures that nodes in the process of starting up don't inadvertedly
cause a connection error due to not yet having written the entire file.
2020-07-13 13:24:22 -03:00