Commit Graph

321 Commits

Author SHA1 Message Date
Vadym Popov
76dbe670cb
lnd: add integration test checks unavailability to pay same preimage 2018-08-21 19:23:22 -07:00
Wilmer Paulino
96a079873a
test: remove sleep timeouts used within channel force closure
In this commit, we remove the sleep timeouts used within the channel
force closure integration test. This is needed because the recent changes
within the ChainNotifier require a longer timeout due to making a
database transaction on every new block to update the confirm/spend
hints of transactions. Rather than increasing the timeouts, we simply
remove them to ensure this isn't an issue down the road.
2018-08-21 13:02:16 -04:00
Olaoluwa Osuntokun
147596047f
Merge pull request #1687 from halseth/disable-inactive-channels
Send ChannelUpdate with Disabled bit if channel inactive for 20 minutes
2018-08-17 18:04:19 -07:00
Olaoluwa Osuntokun
4c51f9b5ae
Merge pull request #1693 from wpaulino/autopilot-zero-conf-inputs
multi: allow use of unconfirmed outputs for funding transactions
2018-08-17 17:06:09 -07:00
Johan T. Halseth
7b1ac0a979
lnd test: check inactive channel disables in testSendUpdateDisableChannel 2018-08-17 23:24:14 +02:00
Johan T. Halseth
53d319ad10
lnd_test: use shutdownAndAssert 2018-08-17 23:24:13 +02:00
Johan T. Halseth
940d0735f8
lnd_test: use dave to listen for ChannelUpdates in testSendUpdateDisableChannel
This commit changes the test testSendUpdateDisableChannel to use Dave to
listen for channel updates, as was originally intended.

Since a ChannelUpdate won't propagate in the network if the channel is
already closed (if the closing transaction has been mined), we change
the closing procedure to initiate the closing process, wait for the
ChannelUpdates, then finally mining the closing transaction. This avoids
a propagation race between the mined block and the ChannelUpdate.
2018-08-17 23:24:12 +02:00
Wilmer Paulino
169ebad6c5
lnd_test: add test for funding channels with unconfirmed outputs 2018-08-16 20:22:43 -07:00
Wilmer Paulino
9ec6433863
lntest: extend OpenChannel to specify whether confirmed funds should be
used
2018-08-16 20:22:42 -07:00
Johan T. Halseth
6e33115da9
lnd_test: return err from assertNumActiveHtlcs, print predErr 2018-08-14 09:09:02 +02:00
Offer Markovich
57d87aef3b test: ensure integration tests use unique context timeouts for each assertion 2018-08-09 12:37:30 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Johan T. Halseth
afccca59c4
lnd_test: add testDataLossProtection
This commit adds the integration test testDataLossProtection, that
ensures that when a node loses state, the channel counterparty will
force close the channel, and they both can recover their funds.
2018-07-31 15:16:24 +02:00
Johan T. Halseth
f8751350bc
lnd_test: set --nolisten for node being cheated
In this commit we modify the integration tests slightly, by setting the
parties that gets breached during the breach tests to --nolisten. We do
this to ensure that once the data protection logic is in place, they
nodes won't automatically connect, detect the state desync and recover
before we are able to trigger the breach.
2018-07-31 08:27:03 +02:00
Johan T. Halseth
45a1fa54d8
lnd_test: check close status also for force closes
This commit makes sure the channels that are force closed also are put
into the state "waiting close" before the commitment transaction is
confirmed, and exits this state when it confirms.

This was previously not checked, as this check was added before the
"waiting close" state was introduced.
2018-07-26 09:18:42 +02:00
Johan T. Halseth
f73a2f362e
lnd_test: correct that Bob can sweep immediately
This commit fixes a flake within the integration tests, where we would
mine a set of blocks before checking if Bob's sweep tx was in the
mempool. Usually this would pass since the blocks were generated before
the tx hit the miner's mempool, but sometimes it was mined and then we
would check the mempool.

This commit fixes this by correctly waiting immediately for Bob to sweep
his funds, as they are not time locked.
2018-07-26 09:18:42 +02:00
Olaoluwa Osuntokun
e0baa49690
Merge pull request #1387 from wpaulino/send-disable-chan-update
multi: send a channel update with disabled flag set on channel close
2018-07-23 17:46:37 -07:00
Johan T. Halseth
77f0020697
lnd_test: account for justice tx broadcast failure 2018-07-22 23:09:08 +02:00
Johan T. Halseth
9fffe23696
contractcourt/contract_resolvers: make htlcOutgoingContestResolver act on conf 2018-07-22 23:07:53 +02:00
Johan T. Halseth
fdf3b407c9
lnd_test: correct node names in comments, format file 2018-07-22 11:20:23 +02:00
Wilmer Paulino
b70319e0d6
test: ensure harness nodes are connected before running each test
Due to some of the previous commits, we no longer have persistent
connections to peers whom we have no open channels with. It might be the
case that this is triggered throughout any of the tests, so we'll ensure
that the Alice and Bob harnesses are connected before running each test.
2018-07-17 17:35:34 -07:00
Wilmer Paulino
e3162605be
test: add test to garbage collect link nodes 2018-07-17 17:35:33 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Wilmer Paulino
7bc9eb96ac
test: wait until closed channel notification is received
In this commit, we modify the graph topology notifications test to wait
until a graph update notification has been received for a closed
channel, rather than assume the next graph update will be for the closed
channel itself.
2018-07-11 17:07:05 -07:00
Wilmer Paulino
a6136c16b0
test: add test to ensure channel updates are sent with disabled active 2018-07-11 17:07:04 -07:00
Olaoluwa Osuntokun
93207608b5
Merge pull request #1125 from Roasbeef/streaming-invoice-improvements
channeldb+lnrpc: re-work invoicing API to implement robust streaming notification delivery
2018-07-10 20:42:00 -07:00
jonny1000
273f030390 test: fix type in comment 2018-07-10 17:06:55 -07:00
Olaoluwa Osuntokun
43d1d1f4f2
test: extend testInvoiceSubscriptions to test historical notification dispatch 2018-07-06 16:45:01 -07:00
Olaoluwa Osuntokun
29a27bbc3a
test: ensure we always cancel active streaming notifications 2018-07-06 12:21:54 -07:00
Conner Fromknecht
92cbfbccca
lnd_test: remove itest race caused by mining extra block 2018-07-03 17:08:21 -07:00
Joost Jager
70ff4414d9 lnd_test: use different fee policy in multi hop payment test
This change makes the test more sensitive to bugs than a route
with nodes that all enforce the same fee policy.

In addition to that, the fee has been increased to a level
at which potential problems with improper fee calculation
become detectable (and not disappear in rounding).
2018-06-28 13:53:45 +02:00
Olaoluwa Osuntokun
0d607f675f
Merge pull request #1344 from halseth/lndtest-defer-shutdown
integration tests: shut down nodes using defer
2018-06-13 15:57:17 -07:00
Wilmer Paulino
70a52c9eae
lnd_test: add route fee cutoff test 2018-06-12 18:14:52 -07:00
Wilmer Paulino
b2585f33ad
lnd_test: refactor out waitForChannelUpdate and assertChannelPolicy 2018-06-12 18:14:51 -07:00
Olaoluwa Osuntokun
418ecbaa15
test: fix flake by allowing channel to load before close 2018-06-10 23:02:23 -07:00
Olaoluwa Osuntokun
179b25c580
test: update switch persistence tests to account for bug fix in reconnection logic
With the recent bug fixes in the peer connection, it's no longer the
case that just disconnecting a certain peer causes it to no longer
connect to the other. As a result, we now shutdown Alice to ensure no
reconnection occurs. We'll then later restart alice when we restart
dave.
2018-06-10 23:02:22 -07:00
Johan T. Halseth
5d8aaa94f1
lnd_test: add missing node shutdowns 2018-06-10 10:07:01 +02:00
Johan T. Halseth
abe590b752
lnd_test: shutdown nodes using defers
This commit adds the helper method shutdownAndAssert, and makes us shut
down nodes created temporarily during the test cases using defers
instead of at the end of the test. This makes it easier to remember to
shut them down, as it is done right after they are started.
2018-06-10 10:07:00 +02:00
t4sk
e4e8b86137 tests: add integration tests for send to route
This commit add 3 integration tests for send-to-route RPC call.
One test ensures that single-hop payments are processed. Another test
checks that payments through a multi-hop route are processed. Lastly,
there is a test to check error propagation while sending payments via fake
predefined route.
2018-06-06 20:45:01 -07:00
Olaoluwa Osuntokun
19e826cada
test: fix constant compliation error 2018-05-25 19:57:30 -07:00
Olaoluwa Osuntokun
fa5c0b9ee7
Merge pull request #1246 from wpaulino/bump-ltc-limits
config: increase max funding and payment amount 60x under Litecoin
2018-05-25 19:33:04 -07:00
Olaoluwa Osuntokun
b401cb6401
Merge pull request #1279 from wpaulino/itest-flakes
test: fix multiple integration test flakes
2018-05-25 19:25:36 -07:00
Wilmer Paulino
3e7c69e596
Revert "test: account for block race by mining additional block in remote htlc force close test"
Before the previous commit, we assumed the HTLC's timeout transaction
would be the only transaction in the mempool. In reality, after mining
some blocks for the HTLC to expire and waiting for the timeout
transaction to arrive in the mempool, at times we would instead detect
the funding output's sweeping transaction and proceed the test with this
assumption, leading to the case where we would have to mine extra blocks
to include the HTLC sweeping transaction. This has been resolved in the
previous commit, so this fix is no longer needed.

This reverts commit e54f1ea4dbe59b2e53a94774995ae1711746c2f8.
2018-05-25 11:19:35 -04:00
Wilmer Paulino
84fcf5b12f
test: detect funding output sweep tx after force close
In this commit, we address an existing flake that would be triggered
when testing HTLC timeouts. After force closing a channel and generating
enough blocks to expire an HTLC, we would wait for a transaction to
arrive in the mempool and assumed it was the timeout transaction.
Instead, we'd detect the funding output sweep transaction and attempt to
proceed with the test with the incorrect assumption of the timeout
transaction being broadcast.
2018-05-25 11:19:15 -04:00
Wilmer Paulino
a3e0c9ca0b
test: expect sweep txs for both sides in the mempool after csv delay 2018-05-25 11:10:03 -04:00
Johan T. Halseth
d0b0734e5b
lnd_test: add testFailingLink
This commit adds an integration test that checks that in case a channel
counterparty tries to settle an HTLC with the wrong preimage, the
channel is failed and force closed.
2018-05-25 06:58:24 +02:00
Wilmer Paulino
e363766394
multi: increase max funding and payment amount 60x under Litecoin 2018-05-25 00:11:20 -04:00
Wilmer Paulino
11c315cffe
test: modify waitForTxInMempool to expect only one tx in the mempool 2018-05-24 22:56:51 -04:00
Wilmer Paulino
d8325e29fd
test: use graph notifications to receive node announcement
In this commit, we rewrite the node announcement integration test to no
longer depend on a sleep interval. Instead, we use graph topology
updates in order to be notified exactly when we receive the node
announcement.
2018-05-24 22:56:49 -04:00
Johan T. Halseth
74205a64fd
lnd_test: check for coop closed channel among WaitingClose instead of PendingClosed 2018-05-22 14:30:30 +02:00
Wilmer Paulino
e5052f124b
lnd_test: fix update channel policy flake
In this commit, we address a timeout issue on our Travis builds within
the update channel policy integration test. Before asserting the policy
for the channel between Alice and Bob, we need to make sure we receive
the updates responsible for modifying this policy first. At times, the
update wasn't received in time before checking the policy, which led to
us checking the old policy. We fix this by explicitly making sure we
wait for the updates first.
2018-05-10 20:03:01 -04:00
Johan T. Halseth
0d435eff68
lnd_test: print predErr instead of generic waitPredicate error 2018-05-09 10:28:00 +02:00
Johan T. Halseth
03d2aa360f
lnd_test: fix flake from routing hints for inactive channel
This commit attempts to fix a flake we have seen, where a routing hints
for an inactive channel was unexpectedly added to the invoice. This
happened because of a race between shutting down the endpoint of this
channel (Eve) and creating the invoice. This commit fixes this by moving
the call to AddInvoice with corresponding route hint check inside a
WaitPredicate.
2018-05-09 10:25:08 +02:00
Olaoluwa Osuntokun
9017d18f14
Merge pull request #1178 from Roasbeef/travis-htlc-block-race-fix
test: attempt to account for internal block race in htlc force close …
2018-05-03 21:08:52 -07:00
Olaoluwa Osuntokun
d50247304b
test: fix flake in testInvoiceRoutingHints by using WaitPredicate 2018-05-03 21:07:11 -07:00
Olaoluwa Osuntokun
8712ab110d
test: fix revocation integration test flake
In this commit, we fix an existing flake within the set of revocation
integration tests. Right after Bob's restart, we attempt to force close
the channel. However, it may be the case that the chain arbitrator
hasn't yet been created. As a result, the request to force close the
channel will fail. We easily fix this by wrapping the force close
attempt in a WaitPredicate.
2018-05-03 20:50:04 -07:00
Olaoluwa Osuntokun
e54f1ea4db
test: account for block race by mining additional block in remote htlc force close test
This commit is similar to a recent commit which attempts to account for
internal block races by mining a second block if the initial assertion
for HTLC state fails. This can happen again if by the time that the
sweeping transaction is broadcast, it doesn't make it into the next
block mine.
2018-05-03 20:12:46 -07:00
Olaoluwa Osuntokun
1e7f2c32e9
test: attempt to account for internal block race in htlc force close test
In this commit, we modify the
testMultHopRemoteForceCloseOnChainHtlcTimeout test slightly to attempt
to account for a block race between the arrival of a message betwen the
contract resolver and the utxo nursery. If this message arrives "late"
(relative to the speed with which we mine blocks in test), then it'll be
detected as such by the utxo nursery. However, since we attempt to mine
a precise number of blocks, if this happens, then we'll never actually
mine that extra block to trigger a broadcast of the sweep transaction.
2018-05-03 20:12:46 -07:00
Conner Fromknecht
57245b5784
lnd_test: convert hodlhtlc -> hodl.exit_settle 2018-05-02 00:21:08 -07:00
Oliver Gugger
578f1d9332 lnd_test: give nodes a name and print that name in log file name 2018-04-28 17:46:50 +03:00
Johan T. Halseth
23f67ef009
lnd_test: remove racy block generation
This commit removes the mining of a block within the integration tests,
that would lead to a flake during runs. The reason was that the sweeoing
transaction was actually broadcast already at this point, and this block
was mined with the assumption that it wasn't. However, test would pass
more often than not because the UTXO nursery would be working on
graduating new heights, whcih is a bit slow, so in most cases the block
would be mined before it had broadcast the sweeping transaction.

By removing this block we ensure that the sweeping transaction will be
found for sure in the waitForTxInMempool call below.
2018-04-27 10:01:05 +02:00
Conner Fromknecht
5049d3956b
lnd_test: adds wallet recovery test 2018-04-26 16:34:21 -07:00
Johan T. Halseth
8d5a33e349
lnd_test: modify tests to work with on-chain spend registrations
This commit modifies the integration tests to work with the recent
 changes to the ChannelArbitrator, where it will only act on commitments
 that has been confirmed. Main changes involving when to look for
 transactions in the mempool and in blocks, and using the new RPC for
 getting channels in the "waiting close" phase when they are waiting for
 the commitment to confirm.
2018-04-25 09:37:26 +02:00
Johan T. Halseth
028d1b7e26
lnd_test: add more relevant info to error messages 2018-04-25 09:37:26 +02:00
Wilmer Paulino
f3653339e1
lnd_test: add test for including routing hints in an invoice 2018-04-21 11:37:38 -04:00
Wilmer Paulino
cb8bdc2d21
lnd_test: add test for multi-hop payments over private channels 2018-04-20 19:45:03 -04:00
Wilmer Paulino
8469fddb33
lnd_test: modify openChannelAndAssert to open private or public channels 2018-04-20 19:45:02 -04:00
t4sk
eb80d07b26 tests: add integration tests for queryroutes 2018-04-19 09:15:21 +08:00
Dimitris Tsapakidis
4009f7f874 multi: fix typos in comments 2018-04-17 19:03:27 -07:00
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07:00
Johan T. Halseth
6573eed37b
lnd_test: wrap check for expected number of channels in WaitPredicate 2018-04-15 18:55:55 +02:00
Johan T. Halseth
4bd45b22eb
lnd_test: make assertActiveHtlcs correctly check the exact pay hashes 2018-04-15 11:36:20 +02:00
Olaoluwa Osuntokun
4bf86aab27
test: in testUpdateChannelPolicy wait for Alice to learn of all channels
In this commit, we fix an existing flake in the integration tests. If it
was the case that Alice didn't yet know of all the channels, then the
payment attempt below would fail at times, depending on other timing
factors in the test. We fix this flake by waiting for Alice to learn of
all channels before we proceed to the actual testing logic.
2018-04-13 15:35:59 -07:00
Olaoluwa Osuntokun
5f0d07e485
Merge pull request #1089 from halseth/resolvecontract-missing-return-on-exit
Add missing return on exit to resolveContract
2018-04-13 14:23:13 -07:00
Johan T. Halseth
44f0ec9263
lnd_test: increase timeout for mempool tx 2018-04-13 12:07:58 +02:00
Olaoluwa Osuntokun
f052f18312
test: extend closeChannelAndAssert to also check that channel is no longer pending close
In this commit, we extend the closeChannelAndAssert testing utility
function to ensure that the channel is no longer marked as "pending
close" in the database. With this change, we hop to catch a recently
reported issue wherein users report that a co-op close channel has been
fully confirmed, yet it still pops up in the `pendingchannels` command.
2018-04-12 18:54:32 -07:00
Olaoluwa Osuntokun
3fa2e08665
test: update testUpdateChannelPolicy to ensure Bob's link uses the proper policies
In this commit, we update the testUpdateChannelPolicy to exercise the
recent set of changes within the switch. If one applies this test to a
fresh branch (without those new changes) it should fail. This is due to
the fact that before, Bob would attempt to apply the constraints of the
incoming link (which we updated) instead of the outgoing link. With the
recent set of changes, the test now properly passes.
2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun
e91dff44e6
test: extend testRevokedCloseRetributionRemoteHodl to have HTLCs in both directions
In this commit, we extend the testRevokedCloseRetributionRemoteHodl so
that the final broadcast revoked transaction has incoming *and* outgoing
HTLC's. As is, this test fails as there's a lingering bug in the way we
generate htlc resolutions. A follow up commit will remedy this issue.
2018-04-04 18:41:33 -07:00
Conner Fromknecht
517135dd9a
lnd_test: use EnsureConnected in itests hot spots
Uses EnsureConnected when reconnecting nodes in:
 - switch offline delivery persistence
 - graph topology notifications
 - channel funding persistence
2018-03-31 02:00:05 -07:00
Olaoluwa Osuntokun
2526827b6d
test: modify sphinx replay test to force close the final channel
In this commit, we modify the sphinx replay test to actually force close
that final channel. We do this, as otherwise, we'll now reject the co-op
close attempt as the channel still has active HTLCs.
2018-03-30 14:53:05 -07:00
Olaoluwa Osuntokun
4253b85309
test: ensure tests convert from BTC to SAT properly
This commit is a follow up to the prior commit which fixed a rounding
error bug in lnwallet. For uniformity, we also fix other occurrences in
the breach arbiter, as well as the integration tests.
2018-03-25 19:17:01 -07:00
Wilmer Paulino
900cd43768
multi: change to lnrpc.Channel type due to proto update 2018-03-19 11:19:06 -04:00
Conner Fromknecht
6c42dd2c09
lnd_test: removes unnecessary disconnects from switch itest
This commit removes two unnecessary disconnect/reconnect attempts
from the switch itest. Both occur after the primary test has been
completed, and were being executed before doing a final sanity check
that the path is still usable. Nothing about the test behavior should
change.
2018-03-14 16:25:45 -07:00
Conner Fromknecht
72dcf44246
lnd_test: harden switch persistence itests
This commits removes many of the timeout-based consistency
checks, which tend to be less dependable on Travis. They
have been replaced with stronger WaitPredicates, and the new
WaitInvariant where appropriate. This should give provide a
much greater degree of reliability in our highly-variant
testing environments.
2018-03-14 02:19:30 -07:00
Conner Fromknecht
36f0eb2799
lnd_test: move retribution tests after switch persistence 2018-03-12 14:46:29 -07:00
Conner Fromknecht
6b74e28858
lnd_test: adds advanced switch persistence test, checking:
//   1. Carol --> Dave --> Alice --> Bob  forward payment
//   2. Carol --- Dave  X  Alice --- Bob  disconnect intermediaries
//   3. Carol --- Dave  X  Alice <-- Bob  settle last hop
//   4. Carol --- Dave  X         X       shutdown Bob, restart Alice
//   5. Carol <-- Dave <-- Alice  X       expect settle to propagate
2018-03-09 21:18:17 -08:00
Conner Fromknecht
38b04ec357
lnd_test: adds switch offline delivery outgoing offline itest 2018-03-09 21:18:16 -08:00
Conner Fromknecht
cf0ab41ce8
lnd_test: adds sphinx replay and switch persistence tests 2018-03-09 21:18:16 -08:00
Conner Fromknecht
58324e0d38
lnd_test: add wait predicate to retribution balance check 2018-03-09 21:18:16 -08:00
Conner Fromknecht
e1745f72aa
lnd_test: bump async bidrect timeout to account sphinx replay writes 2018-03-08 21:12:05 -05:00
Olaoluwa Osuntokun
643159caff
test: extend testMultiHopPayments to check feereport and forwarding history 2018-03-06 13:56:13 -05:00
Johan T. Halseth
b9f09a666d
lnd test: calculate channel reserve based on balance before fees 2018-02-26 22:42:27 +01:00
Johan T. Halseth
f42c16b612
lnd test: ensure static fee is not rounded down 2018-02-26 22:42:27 +01:00
Johan T. Halseth
78514acd49
integration tests: accoount for channel reserve when sending payments. 2018-02-08 18:35:24 -05:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
Wilmer Paulino
f674e10a2b
lnd+cmd/lncli: handle ChannelPoint funding txid proto update
Since a ChannelPoint's funding txid can now be get/set as raw bytes or
a string, we first need to check what type it's currently set to before
accessing it.
2018-01-27 22:00:01 -05:00
Johan T. Halseth
764323eb69
integration tests: use wait predicate to get Bob balance 2018-01-24 11:12:52 +01:00
Johan T. Halseth
786ca6cc50
integration test: improve logging in case of channel announcement failure 2018-01-24 10:26:29 +01:00
Olaoluwa Osuntokun
2d104b7ec0
test: wait for 2 transactions to enter mempool at the end of testMultiHopHtlcRemoteChainClaim
In this commit, we fix an existing flake on Travis related to the new
set of on-chain HTLC tests. In this timing flake, Bob would broadcast
his sweeping transaction, but *mid block mining*. As a result, the
output would never be properly swept, needing an additional block to be
mined. We’ll now wait for both Bob’s sweeping transaction, and Carol’s
sweep transaction to be confirmed before we attempt our assertions.
2018-01-23 19:05:36 -08:00
Olaoluwa Osuntokun
5dc0d669a6
contractcourt: watch proper output within htlcOutgoingContestResolver
In this commit, we fix an existing bug in the implementation of the
resolution of the htlcOutgoingContestResolver. Before this commit, we
would _always_ watch the claim outpoint. However, if this is on the
remote party’s commitment transaction, then we would end up watching
the wrong output. We’ll now properly detect this by modifying which
output we watch, based on if we have a second level transaction or not.
2018-01-23 14:16:22 -08:00