Commit Graph

477 Commits

Author SHA1 Message Date
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
Oliver Gugger
ecca1f9653
itest: fix flakiness around/startup/reconnect 2020-07-27 14:15:36 +02:00
Olaoluwa Osuntokun
14a047ffba
Merge pull request #4455 from cfromknecht/psbt-no-publish
PSBT: add no_publish flag for safe batch channel opens v2
2020-07-20 12:04:10 -07: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
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
Matheus Degiovani
9f036b4310 lntest: wait for graph subscription on node init
During the channel_backup_restore/restore_during_unlock itest, the node
is restored from seed and immediately restarted. Depending on specific
timing of the machine, the test harness might not have had the graph
subscription processed before the node shuts down, causing the harness
to trigger a panic.

Reducing this to a synchronous subscription attempt means node
initialization necessarily waits until the subscription is done before
attempting to restart, reducing flakiness and ensuring correct behavior.
2020-07-13 13:24:22 -03:00
Matheus Degiovani
f52ee770f4 lntest: use ctx when not using macaroons
This forces the Dial attempt to succeed or fail before proceeding with
node setup.

We also log on the node a failure to establish the graph subscription
before panicking so that we can more easily find issues.
2020-07-13 13:24:22 -03:00
Matheus Degiovani
19873f721f lntest: more descriptive errors for CloseChannel
This improves the error reporting for the harness' CloseChannel so that
the exact step where closure fails can be better indicated.

This is to help debug some flaky failures in the CI.
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
Oliver Gugger
1a57dfc24c
itest: do batch PSBT channel open 2020-07-08 22:19:18 -07:00
yyforyongyu
b01947b7dc lnd: fix go fmt 2020-07-08 16:46:51 +08: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
Joost Jager
2903505164
htlcswitch: expose custom records on intercepted packet 2020-06-27 11:00:46 +02:00
Joost Jager
363142de33
htlcswitch: expose additional fields for intercepted packets 2020-06-27 11:00:44 +02:00
yyforyongyu
987edc9d81 multi: add a rpc endpoint to track the recovery process 2020-06-25 15:49:54 +08:00
Joost Jager
8f2a2fc5da
Merge pull request #4018 from breez/intercept-forward-htlc
Intercept forward htlc
2020-06-22 10:18:14 +02:00
Wilmer Paulino
d808ec0d17
itest: add sync error to whitelist 2020-06-18 14:51:45 -07: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
Roei Erez
1a6701122c htlcswitch: change ForwardPackets to return error
As part of the preparation to the switch interceptor feature, this
function is changed  to return error instead of error channel that
is closed automatically.
Returning an error channel has become complex to maintain and
implement when adding more asynchronous flows to the switch.
The change doesn't affect the current behavior which logs the
errors as before.
2020-06-18 12:48:21 +03:00
Oliver Gugger
e73c9218d7
itest: add REST API tests 2020-06-17 08:35:51 +02:00
Andras Banki-Horvath
1dd43f3669 test: add error to itest whitelist 2020-06-02 15:40:20 +02:00
Olaoluwa Osuntokun
6b3c2c1ac5
Merge pull request #4335 from joostjager/queryroutes-limit
rpcserver+routerrpc: remove payment limit
2020-05-28 15:39:15 -07:00
Joost Jager
df7a05da84
rpcserver+routerrpc: remove payment limit 2020-05-28 19:34:17 +02:00
Andras Banki-Horvath
1ae27b4f44 itest: add errors to the whitelist 2020-05-28 13:32:51 +02:00
Conner Fromknecht
0f3ab775c7
Merge pull request #4285 from cfromknecht/pay-addr-index
channeldb: index payments by payment addr, use payment hash as fallback
2020-05-27 17:36:30 -07:00
Olaoluwa Osuntokun
eddd9049dc
Merge pull request #4252 from cfromknecht/rename-kvdb-read
multi: rename kvdb Read* types to R*
2020-05-27 15:52:49 -07:00
Conner Fromknecht
152d153e7f
itest: increase mempool timeout
Neutrino can get slow towards the end of the itests.
2020-05-26 19:49:42 -07:00
Conner Fromknecht
5c4ab4b7cf
lntest: update error whitelist 2020-05-26 19:49:42 -07:00
Conner Fromknecht
d0f3f6166d
lntest/itest: add link error to whitelist 2020-05-26 18:21:08 -07:00
carla
97a843f3cd
walletrpc: add LabelTransaction rpc 2020-05-25 11:33:33 +02:00
Joost Jager
d2f6140818
itest: extend whitelist 2020-05-20 17:24:36 +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
Olaoluwa Osuntokun
c2516d9352
Merge pull request #4286 from guggero/remove-global-cfg
multi: remove global cfg variable
2020-05-18 19:45:43 -07:00
Wilmer Paulino
db2589ee8d
itest: add disconnection error to whitelist 2020-05-18 16:14:31 -07: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
Conner Fromknecht
b6915d9fbf
Merge pull request #3892 from matheusdtech/fix-lingering-contract
contractcourt: fix lingering contract after local breach
2020-05-12 11:46:26 -07:00
Joost Jager
261588cc8e
itest: switch over to routerrpc.SendToRouteV2 2020-05-12 19:56:58 +02:00
Joost Jager
b6170788ea
routerrpc: add SendToRouteV2 that returns an HTLCAttempt message
Unify data structure with SendPayment/ListPayments.
2020-05-12 19:56:54 +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
Joost Jager
25a50b62fb
itest: extend whitelist 2020-05-12 09:13:41 +02:00
Joost Jager
e1e4c8ef6b
itest: extend whitelist 2020-05-08 13:40:31 +02:00
Joost Jager
c0da0675c1
itest: add error detection explanation 2020-05-08 13:40:29 +02: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
Olaoluwa Osuntokun
50ddb53e28
Merge pull request #4249 from joostjager/extend-itest-whitelist
itest: extend whitelist
2020-05-06 16:38:03 -07:00
Olaoluwa Osuntokun
4a90d55789
Merge pull request #4234 from carlaKC/htlcnotifier-unknownfailuredetail
routerrpc+lntest: add nil check for failure detail and add itest coverage
2020-05-06 16:31:43 -07:00
Joost Jager
6f153d6eaa
itest: extend whitelist 2020-05-06 21:21:51 +02:00
carla
18b0049e5e
lntest/test: add check for sweeps in ListSweeps for force close test 2020-05-06 09:25:44 +02:00
Joost Jager
b59c0e1349
itest: add SendPaymentV2 to whitelist 2020-05-04 23:42:57 +02:00
Joost Jager
542e1466b1
itest: case insensitive log errors check 2020-05-04 22:20:24 +02:00
Conner Fromknecht
315c56607c
Merge pull request #4161 from joostjager/itest-err-guard
itest: check for new errors in logs
2020-05-04 10:15:49 -07:00
carla
a93b55ddbf
lntest/test: add htlc events test to multi-hop error propagation 2020-05-04 10:18:55 +02:00
carla
5a172330d3
lntest/test: move multi-hop error propagation into its own file 2020-05-04 10:18:54 +02:00
carla
b608683c9b
lntest/test: test htlcnotifier stream for successful multi-hop payments 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
Andras Banki-Horvath
556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Andras Banki-Horvath
2b729a78f3 lntest: fix ticker leak 2020-04-24 19:15:08 +02:00
Joost Jager
f6b2410011
routing+routerrpc: rename max_shards to max_parts
Don't introduce a new term and align with the P in MPP.
2020-04-22 14:49:19 +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
1307a96624
itest: check for new errors in logs 2020-04-20 14:02:23 +02:00
Joost Jager
969eecc7d2
routing+routerrpc+lncli: rename MaxHtlcs to MaxShards 2020-04-14 10:31:59 +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
35ebfcda9e
itest: create mpp test context 2020-04-09 08:20:54 +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
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
Olaoluwa Osuntokun
2f8d3c4526
Merge pull request #3256 from joostjager/failure-attribution
routing: failure attribution
2019-08-20 16:53:56 -07:00
ccdle12
05d0d028bc
htlcswitch+config+server: Adds a rejecthtlc flag that disables forwarded
htlcs

config: Adding RejectHTLC field in config struct

This commit adds a RejectHTLC field in the config struct in config.go.
This allows the user to run lnd as a node that does not accept onward
HTLCs.

htlcswitch/switch: Adding a field RejectHTLC to the switch config

This commit adds a field RejectHTLC to the switch config. When the
switch receives an HTLC it will check this flag and if the HTLC is not
from the source hop, the HTLC will be rejected.

htlcswitch/switch: adding check for RejectHTLC flag and incomingChanID

This commit adds a check when receiving UpdateAddHTLC. The check looks
for the RejectHTLC flag set and whether the HTLC is from the sourceHop
(the local switch). If the HTLC is not from the sourceHop, then we
reject the HTLC and return a FailChannelDisabled error.

server: adding RejectHTLC field to initialization of switch

lnd_test: adding test for RejectHTLC

This commit adds a test which tests that a node with the --rejecthtlc
flag will reject any onward HTLCs but still can receive direct HTLCs and
can send HTLCs.
2019-08-20 11:01:44 +01:00
Joost Jager
67e40d4433
htlcswitch: always assume an onion error for malformed htlc failures
Previously a temporary channel failure was returning for unexpected
malformed htlc failures. This is not what we want to communicate to the
sender, because the sender may apply a penalty to us only.

Returning the temporary channel failure is especially problematic if we
ourselves are the sender and the malformed htlc failure comes from our
direct peer. When interpretating the failure, we aren't able to
distinguish anymore between our channel not having enough balance and
our peer sending an unexpected failure back.
2019-08-17 10:24:05 +02:00
Joost Jager
4dd054ae90
multi: remove debug invoices
Debug invoices are rarely used nowadays, but keep asking for maintenance
every time refactoring in primarily the invoice registry occurs. We have
passed the cost/benefit tipping point, so therefore the debug invoice
concept is removed in this commit.

Previously the debughtlc flag also controlled whether hodl masks were
active. It is safe to remove that additional condition because the hodl
masks are still guarded by the dev build tag.
2019-08-14 21:33:03 +02:00
Joost Jager
f1769c8c8c
routing: convert to node pair based
Previously mission control tracked failures on a per node, per channel basis.
This commit changes this to tracking on the level of directed node pairs. The goal
of moving to this coarser-grained level is to reduce the number of required
payment attempts without compromising payment reliability.
2019-08-13 19:21:37 +02:00
Joost Jager
aabd68ebcd
multi: rename FailUnknownPaymentHash to FailIncorrectDetails
Align naming better with the lightning spec. Not the full name of the
failure (FailIncorrectOrUnknownPaymentDetails) is used, because this
would cause too many long lines in the code.
2019-08-08 11:04:17 +02:00
Wilmer Paulino
0431701262
multi: only allow specifying towers to TowerClient through RPC
With the introduction of the WatchtowerClient RPC subserver, the lnd
configuration flag to specify private watchtowers for the client is no
longer needed and can lead to confusion upon users. Therefore, we remove
the flag completely, and only rely on the watchtower client being active
through a new --wtclient.active flag.
2019-07-30 15:18:17 -07:00
Wilmer Paulino
8f010abac5
multi: add watchtower client RPC subserver 2019-07-30 15:18:15 -07:00
nsa
7762d55e80 itest+routing: updating tests to account for BlockPadding 2019-07-23 21:03:30 -04:00