Commit Graph

365 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
8c5d6842c2
Merge pull request #2117 from halseth/integration-tests-backend-logs
Save integration tests backend logs
2018-12-12 16:07:25 -08:00
Olaoluwa Osuntokun
56a74e7cfd
Merge pull request #2156 from halseth/integration-tests-wait-before-mining
[Integration tests]: make sure miner have seen tx before mining
2018-12-12 15:57:50 -08:00
AdamISZ
9bb2a26948
Add listunspent RPC call
Returns a brief json summary of each utxo found by calling
ListUnspentWitness in the wallet. The two arguments are the
minimum and maximum number of conrfirmations (0=include
unconfirmed)
2018-12-11 15:26:38 +01:00
Johan T. Halseth
bea31310e1
lnd_test: make sure miner have seen tx before mining
This commit makes mineBlocks take an argument to check the number of txs
expected in the mempool before mining. By using waitForTxInMempool
before mining blocks we ensure that the txs in question have actually
propagated to the miner's mempool before mining the blocks.
2018-11-29 12:33:16 +01:00
Johan T. Halseth
cdcb7105b3
lnd_test: assert existence of unconfirmed tx in mempool 2018-11-29 12:31:40 +01:00
Johan T. Halseth
b07499f227
Merge pull request #2224 from halseth/itest-timeouts
lnd_test: increase test timeouts
2018-11-28 08:22:46 +01:00
Johan T. Halseth
4d05e6bbd8
lnd_test+lntest: keep btcd debug logs from test run
Useful for debugging 🤷
2018-11-27 10:21:19 +01:00
Johan T. Halseth
3a2fd51f2f
lnd_test+lntest: move copyFile() -> lntest.CopyFile() 2018-11-27 10:21:17 +01:00
Johan T. Halseth
ec76a25530
lnd_test: make test use globale defaultCSV 2018-11-27 10:11:32 +01:00
Johan T. Halseth
62e37ec840
lnd_test: use global defaultTimeout instead of test specific timeouts 2018-11-27 10:01:02 +01:00
Johan T. Halseth
f13e5472d5
lnd_test: use global minerMempoolTimeout when waiting for miner to see TXs 2018-11-27 09:59:46 +01:00
Johan T. Halseth
ea32a13fdb
lnd_test: use global channelCloseTimeout when closing channels 2018-11-27 09:59:31 +01:00
Johan T. Halseth
864d77d82e
lnd_test: use global channelOpenTimeout when opening channels 2018-11-27 09:59:29 +01:00
Johan T. Halseth
0c4948b40b
lnd test: add offline scenario to testDataLossProtection
This adds the scenario where a channel is closed while the node is
offline, the node loses state and comes back online. In this case the
node should attempt to resync the channel, and the peer should resend a
channel sync message for the closed channel, such that the node can
retrieve its funds.
2018-11-21 10:28:57 +01:00
Johan T. Halseth
13098a595a
lnd test: refactor testDataLossProtection
This extracts part of the test into a new helper method timeTravel,
which can be used to easily reset a node back to a state where channel
state is lost.
2018-11-21 10:12:04 +01:00
Johan T. Halseth
0ca7c8c5f8
lnd_test: define helper getChanInfo 2018-11-21 10:12:04 +01:00
Johan T. Halseth
eb2f832bba
lnd_test: define createPayReqs helper method 2018-11-21 10:12:04 +01:00
Johan T. Halseth
e1d8b07735
lnd_test: remove unused math/rand rependency 2018-11-21 10:07:56 +01:00
Johan T. Halseth
d7cbdea9db
lnd_test: add waitForChannelPendingForceClose
This commit introduces a new utility method
waitForChannelPendingForceClose, that is used to ensure a force closed
channel has been recognized by the UTXO nursery, and is ready to be
swept as soon as it matures.

The commit also utilizes this method to properly wait before mining
blocks in certain tests, as it makes sure that the UTXO nursery will
react properly to the new blocks.
2018-11-09 08:50:00 +01:00
Johan T. Halseth
1516ceb37a
Merge pull request #2160 from halseth/integration-tests-mine-reorged-funding-tx
[Integration tests] mine reorged funding tx
2018-11-09 08:48:09 +01:00
Johan T. Halseth
1208c66a89
lnd_test: mine reorged out funding tx 2018-11-06 10:35:05 +01:00
Johan T. Halseth
6d91d816a9
lnd_test: remove log disabling hack 2018-11-06 10:27:47 +01:00
Johan T. Halseth
3bb9b398e5
lnd_test: define global test timeouts
In preparation for the added propagation delay by separating the miner
and the chain backend, we increase several timeouts throughout the test,
and extract them into constants that can easily be altered.
2018-11-05 22:16:32 +01:00
Conner Fromknecht
da56aa3528
lnd_test: process all node/edge updates in graph_top_itest
This commit modifies the graph topology test to
properly count channel updates and node
announcments in the event that they are batched
into a single topology update. The prior logic
made the assumption that they were always in
distinct topology updates, so this method should
be more general and robust.
2018-10-24 19:20:01 -07:00
Wilmer Paulino
6686ae3001
lnd_test: update testInvoiceRoutingHints to account
In this commit, we open an additional channel between Bob and Carol to
ensure that Bob gets selected as the only routing hint. Previously Bob
would get selected, but with the recent changes, it would no longer
happen due to him not having any advertised edges.
2018-10-24 19:20:01 -07:00
Wilmer Paulino
7166130037
lnd_test: add onion addresses to testNodeAnnouncement
In this commit, we include onion addresses in testNodeAnnouncement to
ensure they properly propagate throughout the network.
2018-10-23 18:42:33 -07:00
bluetegu
d942bb58c3 Add support for IncludeUnannounced property of ChannelGraphRequest in
DescribeGraph rpc server method.
2018-10-04 14:54:35 -04:00
Olaoluwa Osuntokun
6afee3d099
Merge pull request #1856 from maurycy/typos
multi: fix various typos in comments
2018-09-27 20:38:10 -07:00
Joost Jager
a75b0c871b
lnd_test: add AbandonChannel test 2018-09-20 18:33:47 -07:00
Johan T. Halseth
598904fbb9
lnd_test: restart nodes twice to trigger pruning logic 2018-09-11 10:25:48 +02:00
Johan T. Halseth
a926665358
lnd_test: make sure we stay disconnected using WaitInvariant in testGarbageCollectLinkNodes 2018-09-11 10:25:48 +02:00
maurycy
ac24b12bf2
multi: fix various typos in comments 2018-09-07 06:51:49 +02:00
Olaoluwa Osuntokun
555b7db602
test: fix flake in link node garbage collection test
In this commit, we fix a flake in the link node garbage collection test
by ensuring the channels have been fully closed on both sides before we
attempt to restart and ensure that they don't actually establish
connections. Without this check, it's possible that either side hasn't
yet processed all the blocks, so they'll still reconnect to each other on
start up.
2018-09-06 16:57:32 -07:00
Olaoluwa Osuntokun
32b0f3ff95
Merge pull request #1770 from cfromknecht/prevent-goroutine-fail
lnd_test: Prevent calling Fatal in goroutine
2018-09-03 19:17:00 -07:00
Conner Fromknecht
95a98d86f6
lnd_test: add wait predicates to pending channel checks 2018-08-31 18:34:33 -07:00
Conner Fromknecht
c569c40cef
lnd_test: prevent calling Fatal in goroutine
This commit prevents an error that I've seen on travis,
wherein the test fails because a call to Fatal happens
after the test finishes. The root cause is that we call
Fatal in a goroutine that is reading from the subscribe
graph rpc call.

To fix this, we now pass an err chan back into the main
test context, where we can receive any errors and fail
the test if one comes through.
2018-08-31 17:11:17 -07:00
Conner Fromknecht
a5b9279ca1
lnd_test: correct force close test re: htlc limbo funds
This commit fixes a bug in the integration test, that
reliably fails after disabling the height hint cache.
The test originally asserted that the htlc funds were
in limbo, but was reading a stale copy of the force
close information. Recently, the test was amended to
provided a valid read of the force close in
96a079873a6da2f0a93adc30945971fc07c5e610. However,
the issue was not apparent until build against the
disabled height hint cache.

The test is now correct to assert that there are no
funds in limbo, as the commitment output has been
swept, but the htlcs are still in the contract
court, so the nursery is unaware of them. We also
add another sanity check to validate that there are
no pending htlcs on the force close at that point
in time.
2018-08-26 19:55:38 -07:00
Wilmer Paulino
191c4f3e28
multi: enable txindex on miner harness 2018-08-24 03:36:25 -07:00
Johan T. Halseth
030eca2347
lnd_test: test payment failing because < min_htlc 2018-08-23 07:50:18 +02:00
Johan T. Halseth
7eee09c454
lnd_test: check ChannelUpdate for custom min_htlc 2018-08-23 07:50:17 +02:00
Johan T. Halseth
4c15353116
lnd test: make waitForChannelUpdate take array of updates 2018-08-23 07:50:16 +02:00
Johan T. Halseth
fd7b1c2d5e
lntest/lnd test: make OpenChannel take channel param struct
Also add option for setting min_htlc value on channel creation.
2018-08-23 07:50:16 +02:00
Olaoluwa Osuntokun
4f20905ac1
Merge pull request #1719 from cfromknecht/duplicate-payments
Control Tower: Sender-side checks for duplicate payments #2
2018-08-22 21:22:38 -07:00
Conner Fromknecht
80814cf11d
lnd_test: satisfy linter alignment 2018-08-22 10:26:27 -07:00
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