Commit Graph

342 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
dd08662c87
test: fix linter error 2018-01-22 21:11:34 -08:00
Olaoluwa Osuntokun
d0abb8219c
test: wrap assertion in WaitPredicate in testMultiHopReceiverChainClaim 2018-01-22 21:06:39 -08:00
Olaoluwa Osuntokun
99cc4be448
test: extend timeouts for WaitPredicate on new integration tests 2018-01-22 20:37:32 -08:00
Olaoluwa Osuntokun
968e3e953e
test: extend timeouts on new on-chain htlc integration tests for travis 2018-01-22 19:58:19 -08:00
Olaoluwa Osuntokun
f8adab1f1c
test: add comprehensive integration tests for on-chain HTLC handling
In this commit, we add 6 new integration tests to test the various
actions that may need to be performed when either side goes on-chain to
fully resolve HTLC’s. Many of the tests are mirrors of each other as
they test sweeping/resolving HTLC’s from both commitment transactions.
2018-01-22 19:20:02 -08:00
Olaoluwa Osuntokun
a1e2560b12
test: modify force close integration test to account for recent HTLC changes
In this commit, we modify the testChannelForceClosure integration test
to account for the fact that now the HTLCs are only sent to the nursery
once they’ve fully timed out. Additionally, we now send Carol HTLCs
that she doesn’t know the preimage to, so she doesn’t attempt to sweep
them before we can actually time them out.
2018-01-22 19:20:01 -08:00
Johan T. Halseth
d030773c8d
lnd test: add testUpdateChannelPolicy
This commit adds a new integration test, that checks that
policy/fee updates get propagated properly in the network,
such that the other nodes learn about the changes.
2018-01-12 22:57:05 +01:00
Johan T. Halseth
f4f024aff2
lnd_test: extract graph topology subscription into own method
This commit extracts the launching of a goroutine subscribing
to and forwarding graph topology notifications into its own
utility method, such that it can be used in other tests as
well.
2018-01-12 22:57:04 +01:00
Johan T. Halseth
f1c6d40db8
lnd_test: use defaultBitcoinTimeLockDelta instead of defaultBitcoinForwardingPolicy.TimeLockDelta 2018-01-12 22:56:42 +01:00
Johan T. Halseth
4a1a9d6b14
lnd_test: add name of testcase to node's logfile
This commit adds a line of text including a test case's
name to Alice's and Bob's logfiles during integration
tests, making it easier to seek for the place in the log
where the specific tests start.
2018-01-09 12:59:32 +01:00
Olaoluwa Osuntokun
882b1313ba Merge remote-tracking branch 'origin/pr/445' 2018-01-06 17:22:30 -08:00
Johan T. Halseth
1f19694f50 integration tests: add test for private channels
This commit adds a new test, that in a small network
of 4 nodes, tests that a private channel can be used
for routing payments by the endpoints of the channel,
while the existence of the channel is not known to
the rest of the network.
2018-01-06 17:21:49 -08:00
Conner Fromknecht
978c0dc512
lnd_test: adds polling num channels assertion in breach itests 2018-01-05 13:47:18 -08:00
Olaoluwa Osuntokun
7421584341
lnrpc: making PendingChannels req/resp naming scheme consistent
In this commit we rename the lnrpc.PendingChannelRequest and
lnrpc.PendingChannelResponse to
lnrpc.PendingChannelsRequest/lnrpc.PendingChannelsResponse. We do this
as we strive to ensure that the naming scheme across the RPC interface
is consistent.
2018-01-04 14:20:31 -06:00
Olaoluwa Osuntokun
b74b9fc16e
test: extend time outs in flaky tests due to Travis CI instance speed variance 2017-12-22 19:43:50 +01:00
Olaoluwa Osuntokun
a93be76d16
test: extend timeouts within testRevokedCloseRetribution tests 2017-12-21 11:44:46 +01:00
Olaoluwa Osuntokun
e0c292d960
Merge pull request #486 from cfromknecht/invoice-itest-cancel
lnd_test: invoice subscription cancel lingering goroutine
2017-12-17 18:42:36 -08:00
Olaoluwa Osuntokun
3bf4b5a830
Merge pull request #489 from cfromknecht/force-close-complete-payreq
lnd_test: use completePaymentRequests in channel force close itest
2017-12-17 18:41:01 -08:00
Johan T. Halseth
fa5b5521bf lnd_test: update integration tests for 6 block channel announcements 2017-12-17 18:35:34 -08:00
Jim Posen
84d7c7ee2c lntest: Refactor set up calls to NetworkHarness. 2017-12-14 20:06:23 -08:00
Jim Posen
19ed1fb8db lntest: Add ShutdownNode method to harness.
This is preferable to calling Shutdown on the node directly so that
the harness manages the entire lifecycle of an lnd process.
2017-12-14 20:06:23 -08:00
Jim Posen
43e501feb9 lntest: Rename structs with proper visibility so lnd_test runs. 2017-12-14 20:06:23 -08:00
Jim Posen
88dc73adb0 htlcswitch: Fix failure error handling on outgoing adds. 2017-12-14 17:53:58 -08:00
Conner Fromknecht
c273d83e71
lnd_test: invoice subscription cancel lingering goroutine
This commit adds a small cancellation check to the
invoice subscription integration test. Calls to
Fatalf were observed on travis after the test had
ended stemming from the subscriber's goroutine,
which could happen if the subscription is late.
It also extends the timeout on the test from 5 to
10 seconds.
2017-12-14 15:19:47 -08:00
Conner Fromknecht
932742e1f9
lnd_test: use completePaymentRequests in channel force close itest 2017-12-14 15:19:22 -08:00
Micah Lerner
0f3ff119e8 rpcserver: add SettleDate to rpcserver invoice response 2017-12-08 16:50:04 -08:00
Nalin Bhardwaj
eb13be9adf
tests: Modify to handle changes to WalletBalance response 2017-12-04 05:34:48 +05:30
Olaoluwa Osuntokun
c00a3ae03b
cmd/lncli: fix graph rendering with a single channel 2017-12-02 18:56:01 -08:00
Conner Fromknecht
2ef821ed9a
lnd_test: extends force closure test to test for outgoing htlc incubation 2017-11-16 16:16:00 -08:00
Jim Posen
78f8ddef72 lnd: Remove some sleeps in integration tests.
There is a sleep after channels are opened to ensure the channel is
removed from the set of pending reservations. We can avoid this sleep
and get better guarantees of the channel being opened by deleting the
reservation just before updating channel state to active instead of
after.
2017-11-13 20:52:07 -08:00
Jim Posen
c501da3a95 lnd: Context timeouts on SendPayment RPC request in tests.
This helps catch issues in the RPC tests faster by putting a timeout
on all SendPayment requests. Otherwise, if a payment stalled, the test
would run until the test suite timeout, 10 minutes. Also simplifies
some code with a helper function and using SendPaymentSync where
possible.
2017-11-13 20:52:07 -08:00
Jim Posen
643c23f978 lnd: Improve error handling for node failures in integration tests.
If an lnd node encounters a fatal process errors, we now log the error
asynchronously, instead of calling Fatalf on the test instance. This
is because calling Fatalf in a separate goroutine does not actually
end the test immediately as expected, but rather just kills the
goroutine. This ensures that we see server errors on all nodes before
the test process exits.
2017-11-13 20:52:07 -08:00
Olaoluwa Osuntokun
5a8ebb09f7
test: decrease amount sent in multi-hop error integration test
In this commit, we increase the initial amount sent in the multi-hop
error integration test. We must do this now as the Bandwidth() function
now takes into account the total fee paid within the commitment
transaction. This caused an earlier send to fail instead of the once
following send.

To fix this, we simply send less in the initial test case.
2017-11-10 19:51:14 -08:00
Olaoluwa Osuntokun
4c70135bb8
test: remove testChannelReestablishment integration test
This commit removes the testChannelReestablishment integration test as
it is currently incomplete. In order to properly test this, we require
some infrastructure that allows us to kill the connection at will once
a message is sent across the wire.
2017-11-10 19:51:14 -08:00
Andrey Samokhvalov
d70ffe93e4 htlcswitch+channel: add channel states synchronization
In this commit BOLT№2 retranmission logic for the channel link have
been added. Now if channel link have been initialised with the
'SyncState' field than it will send the lnwire.ChannelReestablish
message and will be waiting for receiving the same message from remote
side. Exchange of this message allow both sides understand which
updates they should exchange with each other in order sync their
states.
2017-11-09 16:38:57 -08:00
Olaoluwa Osuntokun
9eb5b7a0ea
test: add additional sleep in testOpenChannelAfterReorg 2017-11-02 21:30:25 -07:00
Johan T. Halseth
029082fb82
lnd_test: add channel graph reorg test
This commit adds a test for an lnd instance experiecing a reorg,
making sure a channel that is in the channel graph (using the
describegraph rpc call) will no longer be after the funding tx
gets reorged out.
2017-11-03 00:05:33 +01:00
Olaoluwa Osuntokun
8a9cf9af16
test: make assertNumOpenChannelsPending poll every 200ms
In this commit, we modify the assertNumOpenChannelsPending to poll
every 200ms rather than just a single attempt. The goal of this commit
is to reduce the number of flakes on travis caused by slow instances.
2017-11-02 15:48:06 -07:00
Olaoluwa Osuntokun
34a165dd12
test: modify assertNumConnections to use a stoppable ticker 2017-11-02 15:45:19 -07:00
Olaoluwa Osuntokun
885753cae4
test: extend testMultiHopPayments to test a 4 node, 3 hop payment
In this commit, we extend the testMultiHopPayments test case to add an
additional node to the multi-hop payment route: Dave.

Related to #391 as it uses the provided code fragment to reproduce the
bug. With this test in place, we’ll now be able to notice any
regressions in this area.
2017-10-24 18:34:04 -07:00
Olaoluwa Osuntokun
3e64ba0394
test: modify all testing involving HTLC routing to directly use payreqs
In this commit we modify all the test that involve sending payments to
use the payreq returned rather than manually populating the
payhash+dest fields in the SendRequest proto argument to SendPayment.
This is required as if we don’t use the payreq returned, then the
receiving node will reject the payment as it’ll use the global final
CLTV delta value, rather than the value (within the pay req) that the
receiver is expecting.
2017-10-22 18:37:02 -07:00
Olaoluwa Osuntokun
126c73af59
test: increase timeout for testNodeAnnouncement 2017-10-19 21:18:27 -07:00
Olaoluwa Osuntokun
46d4f7216e
test: in testBasicChannelFunding also wait for bob to see channel 2017-10-18 15:13:41 -07:00
Olaoluwa Osuntokun
bbb34cebe0
routing: modify the TestSendPaymentRouteFailureFallback to clear missionControl between attempts
In order to maintain the original essence of the test, we need to clear
the state of missionControl with each attempt, essentially advancing
time between each payment attempt.
2017-10-16 19:07:40 -07:00
Olaoluwa Osuntokun
1d487ea78b Merge pull request #341 from cfromknecht/breach-filter-commit-dust
Breach Arbiter Ignore Dust Commitment Outputs
2017-09-26 17:10:12 -07:00
Conner Fromknecht
d66b8dad62
lnd_test: adds zero-value remote output retribution itest 2017-09-25 18:57:03 -07:00
Olaoluwa Osuntokun
7ae436e30e
htlcswitch+test: send switch back error on lnwallet.ErrInsufficientBalance
This commit fixes a bug related to swallowing an error that should go
to the switch in the case of an insufficient balance error when
attempting to add a new HTLC to the channel state machine. In this
case, an error would never be returned back to the client/switch, and
the internal processing within the channelLink would loop forever,
attempting to add an HTLC that can’t be added due to insufficient
balance to state machine itself.

We fix this issue by only treating the lnwallet.ErrMaxHTLCNumber as the
only error that prompts adding an HTLC to the overflow queue rather
than sending the error directly back to the switch.
2017-09-25 16:10:20 -07:00
Conner Fromknecht
b64d4356c1
lnd_test: adds breach test for remote hodl
This commit alters the existing retribution
  post breach conf test case with the intention
  of testing the correct response in event that
  the remote party broadcasts a prior state
  while HTLCs have been extended. This serves
  as a preliminary integration for an expansion
  of the breach arbiter integration tests.

  The primary change involves using the new
  htlchodl mode for debugging, which causes the
  remote peer to ignore any intent to settle
  incoming HTLCs. The result is that any
  payments sent to the remote party are held in
  limbo, allowing us to test for these
  conditions more accurately.

  Currently the test case only tests that the
  justice transaction is mined. After we have
  fully integrated the breach arbiter to sweep
  2nd layer HTLCs, this test will be altered
  to check for spends from the appropriate
  inputs.
2017-09-19 19:18:20 -07:00
Olaoluwa Osuntokun
3e97aa3931
test: within testListPayments also wait for bob to learn of channel 2017-09-18 17:16:47 -07:00
Conner Fromknecht
4248836a2a lnd_test: use fresh Carol node for breach itest 2017-08-25 17:56:50 -07:00
Conner Fromknecht
85b76570ef lnd_test: increase startup timeout for breach itests 2017-08-25 17:56:50 -07:00
Conner Fromknecht
43b469be5a lnd_test: switch btcrpcclient to rpcclient 2017-08-25 17:56:50 -07:00
Conner Fromknecht
b7e426ecdc lnd_test: test breach persistence after breach conf 2017-08-25 17:56:50 -07:00
Philip Hayes
b19c483a04 breacharbiter: add retribution state persistence
This commit adds a breached contract retribution storage layer using
boltdb to the breach arbiter. The breach arbiter now stores retribution
state on disk between detecting a contract breach, broadcasting a
justice transaction that sweeps the channel, and finally witnessing the
justice transaction confirm on the blockchain. It is critical that such
state is persisted on disk, so that if our node restarts at any point
during the retribution procedure, we can recover and continue from the
persisted state.
2017-08-25 17:56:50 -07:00
Olaoluwa Osuntokun
9f0efddc20
multi: switch from btcrpcclient to rpcclient 2017-08-24 18:54:24 -07:00
Olaoluwa Osuntokun
ed3268b988
test: in testSingleHopInvoice also wait for bob to advertise the channel 2017-08-22 00:54:20 -07:00
Olaoluwa Osuntokun
08d22f8bb4
lnd: modify htlc error integration tests to account for max payment size
This commit modifies the HTLC integration tests to be mindful of the
max payment size. Rather than sending the payment in one large batch,
we instead now send it in chunks of the max payment size.
2017-08-22 00:54:07 -07:00
bryanvu
c87678e695 test: reposition context creation and extend TLS timeout
Fixes timeouts during integration tests on slower machines.
2017-08-19 16:42:33 -07:00
Alex
a7218e84ea lnd_test: reverse the order of teardown for lnd and btcd harnesses
This commit prevents the case where btcd stops before lnd is fully
started, thus making lnd_test hang on trying to stop lnd using
`StopDaemon`. The underlying issue is that while lnd is trying to
start the server and subscribe to block notifications from btcd,
btcd stops, and lnd continues to attempt to reconnect before it
ever starts the interrupt handler. This reversal avoids that issue
by making sure lnd is stopped before btcd.
2017-08-19 16:37:16 -07:00
Alex
58c6989e74 tests: fix several timeout issues 2017-08-14 17:02:31 -07:00
Conner Fromknecht
84a0806da4 lnd_test: allow assertNumConnections to exit early 2017-08-10 16:14:01 -07:00
Conner Fromknecht
56a628d3ad lnd_test: adds polling to assertNumConnections 2017-08-10 16:14:01 -07:00
Johan T. Halseth
6858b1e1b2 integration tests: add sleep before opening second channel.
In the "multiple channel creation" test, in some cases the
responder (Bob) was not yet considering the first channel
to be opened (activeReservation still not deleted in
fundingManager) when Alice tried to open the second channel.
This would cause the test to fail. This commit adds a small
sleep before the creation of the second channel, to give
Bob some time to finish the opening process.
2017-08-10 13:14:25 -07:00
Olaoluwa Osuntokun
f13c81eb6a
test: ensure all tests adhere to maximum funding amount 2017-08-07 16:31:32 -07:00
Olaoluwa Osuntokun
3557274142
test: in testGraphTopologyNotifications only expect 3 notifications
This commit updates the integration tests to reflect the reality after
removing code that would always attempt to increment the current update
timestamp by one for each channel announcement. Without connecting
directly to carol, it isn’t guaranteed that Alice will receive that
announcement as Bob would have already processed one for Carol when
their channel was created.
2017-08-04 18:34:18 -07:00
Olaoluwa Osuntokun
cfa45c15f7
test: add a select statement to avoid error if lnd is shutting down 2017-08-02 21:00:26 -07:00
Johan T. Halseth
e2112702e7 fundingmanager: send node announcements after channel open.
Make the fundingmanager send an updated node announcement
each time it opens a new channel. This is to make sure
our node announcement is propagated in the network, since
peers will ignore our node announcements if we haven't
opened any channels yet.
2017-08-02 15:58:58 -07:00
Olaoluwa Osuntokun
0f2fcf68b2
test: update testChannelFundingPersistence to use --defaultchanconfs 2017-07-30 20:26:38 -07:00
Olaoluwa Osuntokun
fa3fd9a19a
test: update integration tests framework API usage to recent change
OpenPendingChannel and OpenChannel no longer take a number of
confirmations as a parameter.
2017-07-30 20:24:54 -07:00
Andrey Samokhvalov
2d378b3280 htlcswitch+router: add onion error obfuscation
Within the network, it's important that when an HTLC forwarding failure
occurs, the recipient is notified in a timely manner in order to ensure
that errors are graceful and not unknown. For that reason with
accordance to BOLT №4 onion failure obfuscation have been added.
2017-07-14 19:08:04 -07:00
Olaoluwa Osuntokun
f9f9d68543
test: ensure the WaitForBlockchainSync grouting always exits
This commit fixes a minor bug in the goroutine that’s launched to check
the sync status of a particular node. Previously, the goroutine could
end up infinitely stuck on a send as once the chain has been detected
as synced, it didn't exit.

We fix this now by ensure that the goroutine always terminates after
the initial notification to the caller. Additionally, we not ensure
that both the internal and exterior goroutine are both reading off of
the peer’s quit channel.
2017-07-11 16:29:35 -07:00
Olaoluwa Osuntokun
21cb3837c4
test: add synchronization to testDisconnectingTargetPeer 2017-07-06 14:18:04 -07:00
Olaoluwa Osuntokun
f39b7aaaf9
build: create parallel travis builds to isolate race condition tests
This commit modifies the travis build script, and our local test script
to ensure that the race condition builds are conducted in a parallel
build. After this commit two travis builds will be kicked off for each
push/commit: one that runs the race condition tests in isolation, and
another that runs the integration tests then the coverage tests.

In order to do the above cleanly, the integration tests are now guarded
behind a build flag. In order to run the integration tests, one now
needs to specify the `-tags rpctest` flag when running the `go test`
command.
2017-07-04 16:05:22 -07:00
Andrey Samokhvalov
aed2e5865f test: hack fix of panic by disabling btcrpcclient log 2017-06-25 14:19:56 +01:00
Olaoluwa Osuntokun
10ca654054
test: in async bi-di payment test wait for both sides to see the channel 2017-06-19 16:39:12 +02:00
BitfuryLightning
e324fe5818 test: ensure blocks are synchronized before opening channels, allow more time for sync payments
Fix bug with synchronizing blockchain by adding several retries. Allow
to launch individual tests. Increase timeout for async payments.

Fixes #213.
2017-06-19 15:53:52 +02:00
Olaoluwa Osuntokun
a43b5658bb
test: update integration tests to account for base fees
In a recent commit, a default base fee of 1 satoshi has been added, as
a result we now need to factor in the fees paid in a multi-hop setting.
2017-06-17 00:20:14 +02:00
Andrey Samokhvalov
b3f376fac9 test: add async bydirectional test
In this commit additional test have been added which tests the ability
of Alice and Bob asynchroniously exchange the payment between each
other. This scenario will be higly frequent in the payment between
payment providers.
2017-05-31 11:06:08 -07:00
Andrey Samokhvalov
f48f653a7c test: add async payments stress test
In this commit asynchronous stress payment test have been added which
tests the ability of lnd to be sustainable.
2017-05-31 11:06:08 -07:00