Commit Graph

286 Commits

Author SHA1 Message Date
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
770c80635c
lntest: give async payments enough time to complete 2020-03-24 10:00:59 +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
b4ea34037a
lntest: move multi-hop root test case and common utils to own file 2020-03-23 11:19:18 +01:00
Johan T. Halseth
1ade912361
itest: run multi-hop claim tests for all commit types 2020-03-23 11:16:29 +01:00
Johan T. Halseth
6ed0c83d11
itest: spin up new nodes for multi-hop tests
This will let us set their commitment type for the subtest.
2020-03-23 11:13:27 +01:00
Johan T. Halseth
1ce4abc0a9
itest: extract multi-hop tests into sub tests 2020-03-23 11:13:26 +01:00
Johan T. Halseth
5a0f2d004a
itest: update multi hop test case docs
To make clear whcih sweep scenarios are actually being tested
2020-03-23 11:11:25 +01:00
Johan T. Halseth
4b5d91d24d
itest: move multi hop tests to own files
PURE CODE MOVE.
2020-03-23 11:10:33 +01:00
Johan T. Halseth
d81c8bbda7
itest: run force closure test for all commit types
Now that the force closure test has been extracted, spin up new nodes
for each commit type, and ensure the test succeed for all types.
2020-03-23 11:10:31 +01:00
Johan T. Halseth
651bb09c25
itest: extract channel force closure test into subtest
To make it possible to run the for close test for multiple commit types,
we extract it into a subtest, where the two nodes get passed in.
2020-03-23 11:07:36 +01:00
Johan T. Halseth
538f3baac8
itest: print wrong balance in correct format 2020-03-23 11:05:40 +01:00
Joost Jager
d2b6472843
cnct: pre-confirmation anchor sweep
Start anchor sweep attempts immediately after the commitment transaction
has been published. This makes the anchor known to the sweeper and
allows the user to bump the fee on it to get their commitment
transaction confirmed in case the fee committed too is insufficient for
timely confirmation.
2020-03-18 12:26:55 +01:00
Olaoluwa Osuntokun
43323f98fa
lntest/itest: add itest for SCB file restore for anchor commitments
In this commit, we extend the current SCB recovery tests to also cover
the new anchor commitment type. We only add a single test that covers
the most common case to avoid needing to tests all cases for all
commitment types which is being done in a follow up PR.
2020-03-16 17:07:27 -07:00
Olaoluwa Osuntokun
3dda93e30d
Merge pull request #3821 from halseth/pluggable-anchors-lnwallet
[anchor] pluggable anchor commitments
2020-03-09 19:49:05 -07:00
Olaoluwa Osuntokun
cbef26b9f6
Merge pull request #3993 from guggero/unconfirmed-chanbackup
chanbackup: update on-disk backup file with unconfirmed channels
2020-03-09 17:18:23 -07:00
Johan T. Halseth
44756b5811
cfg: rename legacyprotocol to protocol
Since we are also going to use it for experimental new features.
2020-03-09 12:59:34 +01:00
Johan T. Halseth
51c5352ae4
itest: make commit type enum
To prepare for adding more commit types to test for basic channel
funding, we make the commit type an enum that gets its own set of
subtests.
2020-03-09 12:59:34 +01:00
Oliver Gugger
ab024b98ee
rpcserver+itest: remove channel from backup when abandoning it 2020-03-04 10:58:50 +01:00
Oliver Gugger
4e0c276154
rpcserver: don't skip pending channels in backup subscription
The synchronous call to get all channel backups also include
channels that are pending at the moment of the call. A previous
commit added pending channels to the file based backup as well. So
this is the last backup method that needs to be adjusted to also
contain unconfirmed channels.
2020-03-04 10:58:49 +01:00
Oliver Gugger
8a2c02f8ea
itest: test unconfirmed channel backup file 2020-03-04 10:58:49 +01:00
carla
b3e6395635
lntest: check close initiator in basic channel itest
Update channel updates and subscription itest to check that close
initiator is appropriately set for cooperative and force closes for the
local and remote party.
2020-02-21 13:53:57 +02:00
Wilmer Paulino
bed485f0a9
Merge pull request #3194 from halseth/listpayments-test-on-chain-settle
[integration tests]: restart Alice after on-chain settle
2020-01-28 17:29:23 -08:00
Hampus Sjöberg
227e66c469 rpc: Add PendingOpenChannel to SubscribeChannelEvents
This commit adds PendingOpenChannel to SubscribeChannelEvents stream in
the gRPC API.
This is useful for keeping track of channel openings that Autopilot does.
It can also be used for the non-initator side of a channel opening to keep
track of channel openings.
2020-01-24 13:48:18 +01:00
Johan T. Halseth
80ad0fdd5c
lntest: restart Alice after on-chain settle
To ensure lnd is able to pick up an on-chain preimage properly after a
restart, we suspend Alice and check that the payment is listed correctly
as succeeded after a restart.
2020-01-20 14:01:19 +01:00
Johan T. Halseth
bb619352be
lntest: check payment status settled after claim test 2020-01-20 13:55:13 +01:00
Conner Fromknecht
51dbdd3b38
multi: rename key_send, key-send and key send to keysend 2020-01-16 18:37:16 -08:00
Olaoluwa Osuntokun
79948ebe1c
Merge pull request #3854 from matheusdtech/fix-hn-goroutine-leak
lntest: Don't leak node's grpc conn
2020-01-06 17:55:41 -08:00
Olaoluwa Osuntokun
aab956471d
Merge pull request #3846 from guggero/lntest-node-config
itest: make harnesses usable in external projects
2020-01-06 17:52:16 -08:00
Oliver Gugger
ae1f7348f0
lntest: fix macaroon paths
This change makes sure that all macaroons are stored in the same
folder. This makes it possible to use the lntest package in external
projects that use loop's lndclient library which currently assumes
that the admin macaroon and subserver macaroons are in the same sub
folder of lnd's data directory.
2020-01-03 09:19:18 +01:00
Oliver Gugger
ce711a1de7
lntest: specify lnd binary
Integration tests in external projects might not have the same folder
structure as lnd does. Therefore we want to allow the path to the
lnd itest binary to be configurable.
2020-01-03 09:17:23 +01:00
Oliver Gugger
b762d441cf
lntest: expose configuration of harness node
When using the lntest package for itests in external projects, it
is necessary to access a harness node's configuration, for example
to get its data directory on disk. This commit exports that
configuration.
2020-01-03 09:13:29 +01:00
Joost Jager
4273bc0ba2
lntest/itest: add key send test 2019-12-23 21:51:27 +01:00
Joost Jager
bb1e2afc9f
lntest/itest: move single hop invoice test to separate file 2019-12-23 21:51:25 +01:00
Olaoluwa Osuntokun
3de3ec8008
lntest/itest: add new test for external chan point funding 2019-12-20 19:09:56 -08:00
Olaoluwa Osuntokun
be4db0ebca
lntest: add optional FundingShim field to OpenChannelParams 2019-12-20 19:09:48 -08:00
Johan T. Halseth
aea902b788
Merge pull request #3847 from halseth/lnd-test-csv-flake
lnd test: fix csv mempool sweep time
2019-12-19 19:40:37 +01:00
Conner Fromknecht
396a978cec
lntest+wait: replace sleeps in assertAmountSent
This commit constructs a helper closure assertAmountSent that can be
reused by other functions. The closure returns an error so that it can
be used with wait.NoError or the new wait.InvariantNoError. The latter
is added since the predicate could otherwise pass immediately for the
sphinx_replay_persistence tests, but change shortly after. It also
rounds out the wait package so that we offer all combinations of
predicate and no-error style waits.
2019-12-18 23:57:12 -08:00
Matheus Degiovani
67438bd006 lntest: Don't leak node's grpc conn
This changes the HarnessNode structure to hold onto the client grpc
connection made during startup so that it can close it during shutdown.

This is needed because the grpc.Dial function spins a new goroutine that
attempts to maintain an open connection to the target endpoint and
without calling Close() in the connection while shutting down the node
we leak this goroutine to the rest of the tests.
2019-12-18 14:04:07 -03:00
Johan T. Halseth
7044219f90
lnd test: fix csv mempool sweep time
Since CSV locked outputs specifies the first block where they are
allowed to be included, they can actually be added one block earlier
into the mempool.

This led to a flake, where the sweep tx was already in the mempool at
the time we mined the last block, causing the next mempool check to
fail.
2019-12-17 15:29:27 +01:00
Joost Jager
b2f43858c3
invoices: accept mpp payments 2019-12-11 16:14:49 +01:00
Conner Fromknecht
f3398c0c0e
Merge pull request #3789 from cfromknecht/coop-close-rpc-status
republish force and coop closes on startup
2019-12-05 10:35:53 -08:00
Conner Fromknecht
4c30f7d5de
Merge pull request #3719 from guggero/scb-unconfirmed-channels
chanbackup: encode broadcast height in chan ID for unconfirmed channels
2019-12-04 19:26:24 -08:00
Conner Fromknecht
0610578abb
lntest/itest/lnd_test: assert coop close chan status
This commit adds an itest assertion to check that a coop closed
channel's status is properly refelcted in list channels. We also fix a
race condition that prevented the rpc from being externally consistent
by marking the close sooner in the pipeline.
2019-12-04 14:25:29 -08:00
Matheus Degiovani
e98a92233f lntest: Use TCP ports not based in nodeID
This changes TCP port selection in integration tests from being
sequential, based on the node ID to being sequential but tested before
assigment.

This should reduce the number of flaky tests that fail due to the port
already being used by another process in the CI server.
2019-12-03 16:12:14 -03:00
Oliver Gugger
a124bb24da
lntest: add unconfirmed channel SCB test 2019-11-28 08:59:38 +01:00
Olaoluwa Osuntokun
d59aba35a0 Merge branch 'refresh-chan-id' 2019-11-27 15:21:42 -06:00
Olaoluwa Osuntokun
5bdb0d3d66
channeldb+lntest: code style fixes 2019-11-27 15:21:28 -06:00
Roei Erez
8b3dd9415e channeldb: refresh channel state within RefreshShortChanID
Refresh channel memory state whenever the short channel id is refreshed.
This is to make the in-memory channel consistent with the disk data.

Fixes #3765.
2019-11-27 15:10:00 -06:00
Wilmer Paulino
75dbfba4ec
lntest: lower cpfp fee due to new bitcoind max fee restriction 2019-11-25 12:40:01 -08:00
Conner Fromknecht
a83958408d
Merge pull request #3648 from cfromknecht/safe-disconnect
config+itest: allow unsafe disconnect by default
2019-11-22 21:07:17 -08:00
Olaoluwa Osuntokun
74849e7325
Merge pull request #3737 from guggero/resume-scb
chanbackup: continue recovery if channel already exists
2019-11-22 19:40:47 -08:00
Conner Fromknecht
4c5b251748
Merge pull request #3750 from halseth/itest-flake-replacement-forceclose
lnd_test: fix race condition on simultanous force closes
2019-11-22 13:59:31 -08:00
Conner Fromknecht
b07fb37c34
Merge pull request #3751 from halseth/itest-numactivenodes-mtx
lntest/node: add numActiveNodesMtx
2019-11-22 13:56:45 -08:00
Olaoluwa Osuntokun
6f9fcfaccc
Merge pull request #3499 from cfromknecht/mpp-payments-rpc
channeldb+rpcserver: expose legacy payments as multi-path payments
2019-11-21 18:38:53 -08:00
Johan T. Halseth
ddbd7a68ac
lntest/node: add numActiveNodesMtx
Fixes a slight race condition that could happen since Alice and Bob are
created in different goroutines, leading to using the same listening
ports.
2019-11-21 13:57:30 +01:00
Johan T. Halseth
08803e2e41
lnd_test: fix race condition on simultanous force closes
This fixes an issue that would lead to a flake during intergration
tests. Carol would start up with a outdated state and attempt to force
close the channel. At the same time she would connect to Dave,
triggering the dataloss protection. Dave would respond by force closing
the channel, and Dave transaction would in some cases have a higher fee,
resulting Carol's tx being replaced.

We fix this by suspending Dave until Carol's close tx is mined.
2019-11-21 13:43:29 +01:00
Johan T. Halseth
b1e6d9c5cf
Merge pull request #1152 from guggero/macaroon-integrationtest
itest: add tests for macaroon authentication
2019-11-21 09:22:28 +01:00
Olaoluwa Osuntokun
32965fd4be
rpc: update AbandonChannel to remove state from cnct, nursery and graph
In this commit, we update the `AbandonChannel` method to also remove the
state from the countract court as well as the channel graph. Abandoning
a channel is now a three step process: remove from the open channel
state, remove from the graph, remove from the contract court. Between
any step it's possible that the users restarts the process all over
again. As a result, each of the steps below are intended to be
idempotent.

We also update the integration test to assert that no channel is found
in the graph any longer. Before this commit, this test would fail as the
channel was still found in the graph, which can cause other issues for
an operational daemon.

Fixes #3716.
2019-11-20 17:42:58 -08:00
Oliver Gugger
570275435b
lntest: add SCB repeated restore test 2019-11-20 10:57:20 +01:00
Conner Fromknecht
e9eabed99c
lntest: assert mpp fields in listpayments 2019-11-19 20:41:58 -08:00
Conner Fromknecht
216b933d9b
config+itest: allow unsafe disconnect by default
This commit beings the process of deprecating unsafe-disconnect. Many
moons ago this was disallowed to prevent concurency bugs surrounding
reconnect. Despite the name, it has been safe to enable this feature for
well over a year, as several PRs have been merged that addressed the
possible issues that existed when the feature was added.
2019-11-19 20:13:04 -08:00
Conner Fromknecht
aa3e74043d
lntest/harness: improve error message for AssertChannelExists
predErr wasn't always being set when the predicate failed, replace with
wait.NoError.
2019-11-19 20:12:48 -08:00
Conner Fromknecht
c9c7216768
lntest/itest: remove global alice and bob from disconnect test
This will allow us to start Alice and Bob with additional arguments once
we switch to making unsafe-disconnect true by default.
2019-11-19 20:12:29 -08:00
Conner Fromknecht
8e10da03c7
lntest/itest: move chanpoint instantiation down to where it's used 2019-11-19 20:12:07 -08:00
Oliver Gugger
543b258e30
lnd_test: add integration test for macaroon authentication 2019-11-14 16:34:52 +01:00
Oliver Gugger
e8df2757ae
lntest: allow client to connect with specific macaroon 2019-11-13 15:29:00 +01:00
Conner Fromknecht
540e44e186
lntest/itest: expand testSingleHopSendToRoute matrix
In this commit, we refactor the testSingleHopSendToRoute test to support
table driven tests for various endpoints and payment types. Currently
only the main rpcserver's SendToRoute is tested, so we also add
support the SendToRouteSync and the routerrpc's SendToRoute.

The tests are also modified to have each endpoint perform a single-hop,
single-shot MPP payment. This asserts that the Hop messages are being
properly unmarshalled and that setting correctly yields a successful
payment. At the momemnt the receiver does not actually verify or use the
MPP fields presented in the onion, though this test will be expanded
later as those pieces are assembled.
2019-11-04 15:11:55 -08:00
Conner Fromknecht
18a06b0ed3
lntest: remove unnecessary wait from single-hop sendtoroute
We already wait for all channels to open before creating the payment
requests.
2019-11-04 15:11:39 -08:00
Wilmer Paulino
955d143c1b
server+lntest: extract ErrServerNotActive error 2019-10-23 17:37:15 -04:00
Johan T. Halseth
a3a04992b4
lnd_test: give peers more time to successfully attempt connection
We might hit a connection refused error in cases where the peer connects
to us exactly as we try to connect to it. We retry the connection within
a wait predicat, as it should be the case that the other peer
establishes the connection, and the two peers actually connects.
2019-10-07 09:46:23 +02:00
Joost Jager
b58dbb2d70
multi: fix canceled spelling 2019-10-03 17:27:36 +02:00
Lars Lehtonen
085a63fee5
lntest: stdlib context 2019-09-28 15:43:42 -07:00
Olaoluwa Osuntokun
e497a07d64
lntest/itest: extend basic funding test to cover all tweakless commitment cases 2019-09-25 18:26:10 -07:00
Johan T. Halseth
97093b4223
lntest/itest: wait for on-chain balance restore
We add a wait predicate to make sure the node's on-chain balance is
restored before continuing the restore test case.

This is needed since the DLP test scenario includes several restarts of
the node, and if the node isn't done scanning for on-chain balance
before the restart happens, it would be unlocked without a recovery
window, causing funds to be left undiscovered.
2019-09-25 14:04:44 +02:00
Olaoluwa Osuntokun
9b1ecbd3fa
Merge pull request #2485 from halseth/error-codes-dont-send
[lnwire+funding] Don't send ErrorCode on wire
2019-09-23 17:50:27 -07:00
Valentine Wallace
4b9da07e78
rpcserver+lnrpc: allow users to update max HTLC channel policies
In this commit, we enable callers of UpdateChannelPolicy to
specify their desired max HTLC forwarding policy for one or
multiple channels.
2019-09-23 13:07:12 +02:00
Johan T. Halseth
ff37b711c6
funding: dont's send ErrorCode on wire
Since the ErrorCodes are not part of the spec, they cannot be read by
other implementations.

Instead of only sending the error code we therefore send the complete
error message. This will have the same effect at the client, as it will
just get the full error instead of the code indicating which error it
is. It will also be compatible with other impls.

Note that the GRPC error codes will change, since we don't set them
anymore.
2019-09-20 10:55:20 +02:00
Conner Fromknecht
1d41d4d666
multi: move WaitPredicate, WaitNoError, WaitInvariant to lntest/wait 2019-09-19 12:46:29 -07:00
Johan T. Halseth
01f696afce
Merge pull request #3487 from matheusd/lnd-fix-extra-dave
itest: Shutdown final Dave node in testChanRestore
2019-09-12 14:55:53 +02:00
Matheus Degiovani
d6286e9463
itest: Shutdown final Dave node in testChanRestore
This changes the defer function in the test for channel backups to
correctly close over the 'dave' variable.

Without this closure, the shutdownAndAssert call would attempt to
shutdown the original (non-restored) dave instead of the most recently
created (restored) dave, causing a leak of a node during tests.
2019-09-10 09:26:24 -03:00
Johan T. Halseth
d7f0372fa2
lntest/itest: use timeout constants in rejectHTLC test
The local timeout could be too short for certain backends.
2019-09-02 12:05:51 +02:00
Johan T. Halseth
c3480c6066
lntest/bitcoind: set debug loglevel
Co-authored-by: Wilmer Paulino <wilmer.paulino@gmail.com>
2019-09-02 09:37:41 +02:00
Johan T. Halseth
168fc4e1ab
lntest/itest: cleanup force closed channel in testSendUpdateDisableChannel
Otherwise following tests would be flaky because of unexpected sweep transaction in the mempool.
2019-09-02 09:37:37 +02:00
Johan T. Halseth
a57b3de7f9
lntest: compile time check btcd and neutrino BackendCfg interface 2019-09-02 09:37:37 +02:00
Johan T. Halseth
45d41dce17
lntest: add BitcoindBackendCfg 2019-09-02 09:37:33 +02:00
Johan T. Halseth
35f3544111
lnd_test: use RegTest instead of SimNet during integration tests 2019-09-02 09:37:23 +02:00
Wilmer Paulino
578df81fb2
lntest/itest: resolve mempool flake in multi-hop htlc local timeout test
The test assumed that transactions would be broadcast and confirmed at
incorrect heights. Due to timing issues, it was possible for the test to
still succeed, resulting in a flake.

The test assumes that Bob will sweep a pending outgoing HTLC and commit
output back to their wallet. This commit ensures that these operations
are done when expected, i.e.:

1. Bob force closes the channel due to the HTLC timing out.
2. Once the channel is confirmed, Bob broadcasts their HTLC timeout
transaction.
3. Bob broadcasts their commit output sweep transaction once its CSV
expires.
4. Bob broadcasts their second layer sweep transaction for the timed out
HTLC once its CSV expires.
2019-08-30 12:15:14 -07:00
Wilmer Paulino
47a8cd36f7
lntest/itest: prevent direct connection within testNodeAnnouncement
Alice and Dave don't need to be connected in order to receive the node
announcement as we assume that she can receive it from Bob because they
are connected at the beginning of every test.
2019-08-29 18:04:13 -07:00
Johan T. Halseth
9ef66f568f
Merge pull request #2203 from ccdle12/reject-htlc-option
htlcswitch+config+server: adding RejectHTLC flag
2019-08-26 14:53:32 +02:00
Olaoluwa Osuntokun
b1aea41d20
lntest/itest: force dave to use the legacy onion payload in multi-hop pay test
In this commit, we force Dave to use the legacy onion payload for the
multi-hop test to ensure that we're able to properly mix the old and new
formats, and have all nodes properly decode+forward the HTLC.
2019-08-22 18:53:10 -07:00