Commit Graph

241 Commits

Author SHA1 Message Date
Oliver Gugger
f358a4474d
lntest: add log dir flag 2020-11-04 11:03:30 +01:00
Oliver Gugger
9bbf134237
itest: split tests into dynamic tranches 2020-11-04 11:03:29 +01:00
Eugene
225390ab5b
Merge pull request #4487 from Crypt-iQ/cc_pkg_0723
chainreg: new chainreg package
2020-10-30 06:07:26 -04:00
Eugene
bebe258e2d chainregistry+lnd: moving chainregistry+chainparams to new package 2020-10-29 15:24:14 -04:00
Matheus Degiovani
835c73632b
itest: fix off-by-one mining tests
This fixes tests that were surfaced as flaky.  Usually these tests had
an off-by-one error when mining blocks while waiting for a
CSV-encumbered output.
2020-10-28 14:48:15 -03:00
Oliver Gugger
34439fbc2a
itest: cleanup multi-hop tests
As a preparation to fix an issue with the mempool wait, we clean up the
multi-hop itests a bit. We fix the formatting, use the require library
for assertions consistently and simplify some of the wait predicates.
Commonly used code is also extracted into functions.
2020-10-28 13:38:04 +01:00
Oliver Gugger
d1b46211d8
itest: replace WaitForTxBroadcast with WaitForTxInMempool 2020-10-28 13:29:18 +01:00
Oliver Gugger
1714394add
itest: fix send payment flake
In some cases the router isn't yet fully aware of all newly opened
channels. We need to give it some time to process the updates. Therefore
we add a wait for sending payments to give it a few more changes to
catch up.
2020-10-28 13:22:48 +01:00
Oliver Gugger
e6b0141b10
itest: fix typos, formatting 2020-10-28 13:22:48 +01:00
Matheus Degiovani
16a4687718
itest: Fix flakes when payments cause chan closure
This fixes itest flakes that happen when a payment is attempted that
ends up causing a channel closure.

completePaymentRequests() attempts to monitor the open channels after a
payment is attempted in order to identify that payment was actually
dispatched to a remote node before returning.

However, when the payment actually causes a channel closure (for
example, because the receiver sent an incorrect preimage) this logic
fails in that the channel will no longer the found in the list of open
channels. This could cause a flake when there was enough time for the
channel to close before performing the check.

One example of such a flaky test is failing_link.

This fixes the issue by also checking whether the total number of
channels was reduced, which indicates (assuming itest operations are
being executed serially) that one of the attempted payments affected at
least one channel.
2020-10-27 08:07:49 -03:00
Matheus Degiovani
473f730eec
itest: Sync nodes to chain during singleHop tests
This ensures the Carol and Dave nodes created in the single_hop series
of tests are synced to the latest chain tip generated by the miner
before creating the route that will eventually be used for payments.

This prevents a flake during CI tests where slow processing of blocks by
Carol could cause the generated route to have a final CLTV delta too
short for Dave to accept.

While at it, we switch the test to use the default CLTV delta provided
by QueryRoutes which is now the global default CLTV.
2020-10-26 16:29:39 -03:00
yyforyongyu
310f87e271
itest: save temp miner's logs 2020-10-02 00:04:47 +08:00
Conner Fromknecht
68ddba7cb7
Merge pull request #4512 from yyforyongyu/channel-balance-verbose
display verbose result in ChannelBalance
2020-09-25 13:31:01 -07:00
Johan T. Halseth
74e62e5c5b
Merge pull request #4589 from yyforyongyu/itest-proper-cleanup
Itest: proper connect/disconnect miner
2020-09-25 10:31:56 +02:00
yyforyongyu
86779fb6a5
itest: fix code lint 2020-09-24 20:51:58 +08:00
yyforyongyu
48f6c47b17
itest: test all ChannelBalance fields 2020-09-24 20:33:23 +08:00
yyforyongyu
1b200c9930
itest: explicit checking ChannelBalance response 2020-09-24 20:30:51 +08:00
Oliver Gugger
9f7d8dd92e
lntest: make compilable without subserver build tags
To make it possible to compile the itests together with the other tests,
we don't want to use anything from the optional subservers.
2020-09-21 21:16:32 +02:00
Olaoluwa Osuntokun
719e32830d
lntest: fix most linter warnings, silence rest
We fix all linter issues except for the 'lostcontext' and 'unparam' ones
as those are too numerous and would increase the diff even more.
Therefore we silence them in the itest directory for now.
Because the linter is still not build tag aware, we also have to silence
the unused and deadcode sub linters to not get false positives.
2020-09-21 21:16:31 +02:00
Olaoluwa Osuntokun
c769247198
lntest: allow the main test files to be buildable w/o the rpctest build tag
In this commit, we modify our build tag set up to allow the main test
files to be buildable w/o the current rpctest tag. We do this so that
those of us that use extensions which will compile live files like
vim-go can once again fix compile errors as we go in our editors.

In order to do this, we now make an external `testsCases` variable, and
have two variants: one that's empty (no build tag), and one that's fully
populated with all our tests (build tag active). As a result, the main
file will now always build regardless of if the build tag is active or
not, but we'll only actually execute tests if the `testCases` variable
has been populated.

As sample run w/ the tag off:
```
=== RUN   TestLightningNetworkDaemon
--- PASS: TestLightningNetworkDaemon (0.00s)
PASS
ok  	github.com/lightningnetwork/lnd/lntest/itest	0.051s
```
2020-09-21 21:16:31 +02:00
Olaoluwa Osuntokun
95634186c2
lntest/itest: move harness to new file
This in prep for a bigger move in the next commit.
2020-09-21 21:16:30 +02:00
Joost Jager
6ae05c6bac
Merge pull request #4592 from joostjager/sweep-deadline
cnct+sweep: cpfp-aware anchor sweeping
2020-09-18 20:15:03 +02:00
Joost Jager
29602e88e8
cnct: cpfp-sweep anchors
For unconfirmed commit tx anchors, supply the sweeper with cpfp info and
a confirmation target fee estimate.

The sweeper will try to pay for the parent commit tx as long as the
current fee estimate exceeds the pre-signed commit tx fee rate.
2020-09-17 12:30:41 +02:00
yyforyongyu
d2d71476bd
lntest: init SignerClient and test DeriveSharedKey 2020-09-17 14:52:36 +08:00
yyforyongyu
e8d9643f3a
itest: test for connection timeout 2020-09-16 11:50:59 +08:00
Calvin Zachman
f5fb64e552 add new max channel size config option
- let users specify their MAXIMUM WUMBO with new config option which sets the maximum channel size lnd will accept
- current implementation is a simple check by the fundingManager rather than anything to do with the ChannelAcceptor
- Add test cases which verify that maximum channel limit is respected for wumbo/non-wumbo channels
- use --maxchansize 0 value to distinguish set/unset config. If user sets max value to 0 it will not do anything as 0 is currently used to indicate to the funding manager that the limit should not be enforced. This seems justifiable since --maxchansize=0 doesn't seem to make sense at first glance.
- add integration test case to ensure that config parsing and valiation is proper. I simplified the funding managers check electing to rely on config.go to correctly parse and set up either i) non wumbo default limit of 0.16 BTC OR ii) wumbo default soft limit of 10 BTC

Addresses: https://github.com/lightningnetwork/lnd/issues/4557
2020-09-14 21:16:32 -05:00
yyforyongyu
567fa9ed10
itest: disable node retrying to connect to miner
Previously the chainbackend connected to the miner using a permanent
connection, which would retry the connection when it’s disconnected.
It would leave multiple connections between the chainbackend and the
miner, causing difficulties in debugging. Currently, there are two
occasions when disconnection happens. One happens when running the open
channel reorg test, the miner is connected/disconnected multiple times
on purpose. The other happens when the chainbackend receives a
MSG_WITNESS_TX type from the miner, which would be considered as an
invalid type and disconnects the miner. With the latter one being fixed
in btcd, the chainbackend will still be disconnected from the miner if
it reaches the ban score by requesting too many notfound messages in a
short time which is why the `--nobanning` flag is added.
2020-09-12 20:09:54 +08:00
yyforyongyu
724f6e0969
itest: require no error when cleaning up chainbackends 2020-09-12 20:09:53 +08:00
yyforyongyu
933d84273a
itest: require no error when tearing down miners 2020-09-12 20:09:52 +08:00
Oliver Gugger
4346a1a3c6
itest: test max pending and abandon channel for shim chans
We change the external funding test to now test two more things: First
that we can open multiple externally funded channels without needing to
lift the default --maxpendingchannels setting. Then we test that we can
use the safer pending_funding_shim_only flag of the AbandonChannel RPC
to get rid of the never confirming external channels.
2020-08-28 12:28:59 +02:00
Oliver Gugger
8ed0efed0b
itest: use NoError in external funding tests 2020-08-28 12:28:59 +02:00
Oliver Gugger
aa6e3f6d01
itest: extract deriveFundingShim
As a preparation to test accepting multiple externally funded channels
at the same time, we extract the deriveFundingShim function from the
external funding integration test.
2020-08-28 12:28:59 +02:00
Conner Fromknecht
a4031f500b
rpcserver+fundingmanager: thread remote_max_htlcs to channel opening 2020-08-24 20:11:33 -07:00
Conner Fromknecht
5c91be3f57
config+rpcserver: allow configurable defualt-remote-max-htlcs 2020-08-24 20:11:23 -07:00
Conner Fromknecht
8a22e4fd1c
lntest/itest: swap want/got channel constraints
Otherwise the fatal error message incorrectly describes what happpened.
2020-08-24 20:08:19 -07:00
Conner Fromknecht
8390e303c1
lntest/itest: add t.Helper() to assertChannelConstraints 2020-08-24 20:08:15 -07:00
Olaoluwa Osuntokun
bd18f9acf5
Merge pull request #4427 from yyforyongyu/customize-root-key-id
macaroons: customize root key ID
2020-08-21 19:34:15 -07:00
Conner Fromknecht
fd3f7ca6c8
Merge pull request #4434 from carlaKC/labels-general
multi: add labels to lnd native transactions
2020-08-20 12:58:04 -07:00
yyforyongyu
89c3eb7765
itest: test macaroon creation/deletion 2020-08-14 12:36:21 +08:00
Oliver Gugger
0655a1bcfb
itest: move channel backup tests to own file 2020-08-12 16:06:34 +02:00
Oliver Gugger
6115a7b12b
make+itest: make itest Windows compatible 2020-08-05 08:53:04 +02:00
carla
2a614cc596
multi: add labels to lnd native transactions
Follow up labelling of external transactions with labels for the
transaction types we create within lnd. Since these labels will live
a life of string matching, a version number and rigid format is added
so that string matching is less painful. We start out with channel ID,
where available, and a transaction "type". External labels, added in a
previous PR, are not updated to this new versioned label because they
are not lnd-initiated transactions. Label matching can check this case,
then check for a version number.
2020-07-29 13:46:07 +02:00
Olaoluwa Osuntokun
26cff10c19
Merge pull request #4344 from matheusdtech/lntest-improvs
lntest+itest improvements
2020-07-15 18:01:33 -07:00
Matheus Degiovani
0e73d2d243 itest: assert unspent before performing CPFP
This reduces the flakiness of the CPFP test by asserting the wallet has
seen the unspent output before attempting to perform the walletkit's
BumpFee method.

Previously the attempt to bump the fee of the target transaction could
be made before the wallet had had a chance to fully process the
transaction, causing a flaky error.
2020-07-13 13:24:22 -03:00
Matheus Degiovani
3e1b4eadbb itest: switch to openChannelTimeout
This switches a few call sites that used a different timeout when
openening channels to the correct openChannelTimeout, which better deal
with flakes in the CI.
2020-07-13 13:24:22 -03:00
Matheus Degiovani
af660d0152 itest: improve backup check during wt test
This replaces an outstanding sleep for a check for a specific state
during the test for watchtower use: specifically, that the backup has
been sent to the watchtower prior to shutting down Dave.

This reduces flakiness in the test that could occur if the Dave shutdown
without the backup being comitted to the watchtower, causing the rest of
the test to fail.
2020-07-13 13:24:22 -03:00
Olaoluwa Osuntokun
f61e1ac568
lntest/itest: add new test for wumbo channels 2020-07-10 16:27:20 -07:00
Olaoluwa Osuntokun
6c322c5eb2
lntest/itest: fix line wrapping in funding test case 2020-07-10 16:27:18 -07:00
Olaoluwa Osuntokun
43a355321f
lncfg: split off protocol options into normal and legacy, normal reqs no build tag
In this commit, we split off the protocol options into a normal and
legacy sub-config. The legacy sub-config protected by a built tag, and
will only be populated if thet tag is set. Legacy options now have a
`legacy` prefix. So `--protocol.legacyonion` is now `--protocol.onion`,
and `--protocol.committweak`, is now `--protocol.legacy.committweak`.

We also create a new experimental protocol feature sub-config for newer
features that may not yet been fully complete, so they require a build
tag.
2020-07-10 16:27:12 -07:00
carla
177c314f06
lntest: add resolver report assertions to force close test 2020-07-07 19:50:13 +02:00
Wilmer Paulino
6075997ebc
multi: add relative thaw height interpretation
This is useful when we wish to have a channel frozen for a specific
amount of blocks after its confirmation. This could also be done with an
absolute thaw height, but it does not suit cases where a strict block
delta needs to be enforced, as it's not possible to know for certain
when a channel will be included in the chain. To work around this, we
add a relative interpretation of the field, where if its value is below
500,000, then it's interpreted as a relative height. This approach
allows us to prevent further database modifications to account for a
relative thaw height.
2020-07-02 12:05:49 -07:00
yyforyongyu
f11da830b9 lnrpc: expose all local and remote channel constraints 2020-06-30 06:59:18 +08:00
yyforyongyu
987edc9d81 multi: add a rpc endpoint to track the recovery process 2020-06-25 15:49:54 +08:00
Roei Erez
7b56268f70 rpc: implement RPC htlc interceptor.
In this commit we add the ability to intercept forwarded htlc packets
straight from the RPC layer. The RPC layer handles a bidrectional stream
that comminucates to the client the intercepted packets and handles its
response by coordinating with the interceptable switch.
2020-06-18 15:20:07 +03:00
Oliver Gugger
e73c9218d7
itest: add REST API tests 2020-06-17 08:35:51 +02:00
carla
97a843f3cd
walletrpc: add LabelTransaction rpc 2020-05-25 11:33:33 +02:00
Joost Jager
e201ed8106
itest: switch over to routerrpc.SendPaymentV2 2020-05-20 17:23:52 +02:00
Joost Jager
ca9c58aec9
Merge pull request #4183 from joostjager/sync-local-payment
htlcswitch: sync local payment hand-off to link
2020-05-20 11:23:15 +02:00
Joost Jager
c325bf8c57
htlcswitch: sync link hand-off
This commit extends the link with a new synchronous delivery point for
local UpdateAddHTLC messages. The switch method SendHTLC is updated to
use this delivery point and thereby becomes a synchronous call.

For MPP payments, synchronous hand-off is important. Otherwise the next
pathfinding round could start without the channel balance updated yet.
2020-05-20 08:03:48 +02:00
carla
d021eae392
itest: add label check to sweep coins test
Add a label to our sweep all coins itest and check that it is correctly
set.
2020-05-19 13:31:51 +02:00
Oliver Gugger
3b2188d689
multi: move exported items to lncfg 2020-05-14 14:37:51 +02:00
Joost Jager
1bd211a722
Merge pull request #4147 from joostjager/unify-pay-responses
router+routerrpc: unify sendtoroute and payment responses
2020-05-13 20:36:14 +02:00
Joost Jager
261588cc8e
itest: switch over to routerrpc.SendToRouteV2 2020-05-12 19:56:58 +02:00
Matheus Degiovani
d71a4ee033 contractcourt+itest: fix lingering pending channel after breach
This fixes an issue where the contract court could leave a completely
swept commit tx unresolved if it was swept by the remote party.

This could happen if (our) commit tx just published was actually a
previously revoked state, in which case the remote party would claim the
funds via a justice transaction.

This manifested itself in the testRevokedCloseRetribution integration
test where at the end of the test Bob was left with a pending channel
that never resolved itself.
2020-05-12 07:46:14 -03:00
Olaoluwa Osuntokun
3190437188
Merge pull request #4139 from carlaKC/lnrpc-listsweeps
lnrpc: add block height params to GetTransactions and add ListSweeps
2020-05-07 16:44:05 -07:00
carla
18b0049e5e
lntest/test: add check for sweeps in ListSweeps for force close test 2020-05-06 09:25:44 +02:00
carla
5a172330d3
lntest/test: move multi-hop error propagation into its own file 2020-05-04 10:18:54 +02:00
carla
578f6be0a1
lntest/test: move multi-hop payments test into own file 2020-05-04 09:47:01 +02:00
Joost Jager
d451ef4ee1
routerrpc: rename rpcs to SendPaymentV2 and TrackPaymentV2
The message in the response stream changed. Rename the calls themselves,
to prevent older applications from getting decode errors. Especially
troublesome is the case where the request is executed (send payment),
but the application can't read the outcome (payment sent or not?)
2020-04-21 20:36:58 +02:00
Joost Jager
06f73c0a66
lnrpc: remove deprecated payment path
Not applicable anymore on the payment level with multi-part sends.
2020-04-10 11:05:52 +02:00
Joost Jager
ef38f8f2c7
itest: log failure time 2020-04-09 08:20:58 +02:00
Joost Jager
af14f2e425
itest: add multi-part payment test
Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2020-04-09 08:20:56 +02:00
Joost Jager
af4abe7d58
routing+routerrpc: notify full payment structures
This commit fixes the inconsistency between the payment state as
reported by routerrpc.SendPayment/routerrpc.TrackPayment and the main
rpc ListPayments call.

In addition to that, payment state changes are now sent out for every
state change. This opens the door to user interfaces giving more
feedback to the user about the payment process. This is especially
interesting for multi-part payments.
2020-04-08 09:26:33 +02:00
Olaoluwa Osuntokun
7e6f3ece23
Merge pull request #3960 from bitromortac/listpayments-pagination
channeldb+lnrpc+lncli: listpayments pagination support
2020-04-07 17:06:37 -07:00
Conner Fromknecht
f50649d21b
htlcswitch/link: remove overflow queue
This commit removes the overflowQueue from the link. We do so in order
to promote better UX for senders, so that HTLCs are failed faster when
the commitment is full. This gives the sender the opportunity to try
another, more open path, rather than perceive the HTLC as being stuck.

At the same time, we remove the total number of active goroutines in lnd
by a factor of N where N is the number of active channels.
2020-04-07 13:20:36 -07:00
bitromortac
97b759796d itest: fix comment in list_outgoing_payments test 2020-04-07 07:03:51 +02:00
Olaoluwa Osuntokun
e52c5df8ab
Merge pull request #4140 from carlaKC/lnrpc-pendingchannelinitiator
lnrpc: use initiator enum for pending channel open initiator
2020-04-06 15:46:46 -07:00
Olaoluwa Osuntokun
a8a0aaa214
Merge pull request #4143 from cfromknecht/open-channel-flakes
lntest/itest/lnd_test: wait when calling OpenChannel
2020-04-03 18:10:45 -07:00
Wilmer Paulino
f6ff3131d8
lntest/itest: add change address recovery case to onchain recovery test
This is mainly motivated by a now fixed bug in the wallet in which
change addresses could at times be created outside of the default key
scopes. Recovery only used to be performed on the default key scopes, so
ideally this test case would've caught the bug earlier.
2020-04-03 15:26:19 -07:00
carla
2ae61162db
lnrpc: move initiator enum out of close summary
Move enum out of CloseSummary struct for more general use. This does
not change the encoding of the enum, and will only cause compile time
errors for existing clients. This enum has not been included in a
release yet, so we can make this move without much disruption.
2020-04-03 11:26:11 +02:00
Conner Fromknecht
ae41623a91
lntest/itest/lnd_test: wait when calling OpenChannel
In #4130, OpenChannel was changed to assert that the wallet is fully
synced before allowing a channel open. This introduced flakes on travis,
which are resolved here by using a wait predicate when calling
OpenChannel.

Note there is one existing call that was not converted, because it is
interested in the returned error. This call does not have a wait
predicate surrounding it, but this shouldn't cause a flake because other
channels are opened earlier in the test that will have already waited
for the wallet to sync up.
2020-04-02 17:56:00 -07:00
Johan T. Halseth
fee5fd0093
itest: add testSendToRouteMultiPath
testSendToRouteMultiPath tests that we are able to successfully route a
payment using multiple shards across different paths, by using SendToRoute.

Co-authored-by: Joost Jager <joost.jager@gmail.com>
2020-04-02 19:31:23 +02:00
Johan T. Halseth
5adfc968df
routing/payment_lifecycle: return recorded errors
In preparation for MPP we return the terminal errors recorded with the
control tower. The reason is that we cannot return immediately when a
shard fails for MPP, since there might be more shards in flight that we
must wait for. For that reason we instead mark the payment failed in the
control tower, then return this error when we inspect the payment,
seeing it has been failed and there are no shards in flight.
2020-04-02 10:24:35 +02:00
Conner Fromknecht
5660a26b60
rpcserver: add wallet sync check to OpenChannel 2020-03-31 10:21:24 -07:00
Oliver Gugger
c4f20dada4
lntest: test PSBT channel funding 2020-03-31 10:00:12 +02:00
Olaoluwa Osuntokun
0b59ded7ca
Merge pull request #4073 from joostjager/anchor-sweep-itest
lntest/itest: select anchor commitment format and sweeping itests
2020-03-27 13:23:02 -07:00
yyforyongyu
4be1a4d0ec multi: fix typos 2020-03-27 16:59:18 +08:00
Joost Jager
8628a989a6
itest: enable anchor commitment for multi-hop test
These tests exercise the different ways of sweeping a commitment, so
we'll cover the modified scripts used for anchor commitments and
spending the anchor itself by both parties.

Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2020-03-27 08:01:52 +01:00
Joost Jager
23c81949cc
itest: enable anchor type for force close test
Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2020-03-27 08:01:50 +01:00
Joost Jager
714166eeb0
itest: enable anchor type for basic funding flow
Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2020-03-27 08:01:48 +01:00
Johan T. Halseth
e269e3f91b
itest: calcStaticFee based on commit type 2020-03-27 08:01:46 +01:00
Joost Jager
7dbb936791
lntest/itest: use helper functions in calcStaticFee 2020-03-27 08:01:44 +01:00
Joost Jager
0e8eb40625
lntest/itest: add mempool tx utility functions 2020-03-27 07:42:05 +01:00
Joost Jager
863966bac9
lntest/itest: fix scope bug
Fixes a subtle bug where the outer scope predErr was hidden when the
return value of findForceClosedChannel was stored in a newly
defined variable with the same name.
2020-03-27 07:41:59 +01:00
Olaoluwa Osuntokun
d9bcd711d7
Merge pull request #3924 from guggero/itest-scrypt
itest: use fast scrypt options for aezeed, macaroons DB and wallet DB
2020-03-26 16:20:31 -07:00
Johan T. Halseth
8dc5a3c144
itest: wait for file writing in wait predicate 2020-03-24 12:18:42 +01:00
Oliver Gugger
a101c8eeed
lntest: fix timing issue with auto reconnect 2020-03-24 10:00:58 +01:00
Johan T. Halseth
8623bfac22
Merge pull request #4103 from halseth/itest-multi-hop-move
[itests] multi hop test move
2020-03-24 09:37:53 +01:00
Olaoluwa Osuntokun
625d62e007
lntest/itest: update external funding test to exercise frozen chans 2020-03-23 16:57:09 -07:00
Johan T. Halseth
1ce4abc0a9
itest: extract multi-hop tests into sub tests 2020-03-23 11:13:26 +01:00