Commit Graph

357 Commits

Author SHA1 Message Date
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
Andrey Samokhvalov
6861df0e23 rpcserver: add additional 'error' field in payment response
In order to not close the payment stream on payment error the additional
field have been added in payment response. Now error from stream Recv()
function means that something has happend inside the client and we unable
to process any payment farther, and error inside the payment response
means, that something wrong has happend with payment itself.
2017-05-31 11:06:08 -07:00
Olaoluwa Osuntokun
67791755af
lnd: use a default temporary static fee of 50 sat/byte for BTC 2017-05-16 19:12:27 -07:00
bryanvu
4ac7cc719f lnwallet: replace hard-coded fees and adjust tests accordingly
This commit replaces the hard-coded 5000 satoshi fees with calls to the
FeeEstimator interface. This should provide a way to cleanly plug in
additional fee calculation algorithms in the future. This change
affected quite a few tests. When possible, the tests were changed to
assert amounts sent rather than balances so that fees wouldn't need to
be taken into account. There were several tests for which this wasn't
possible, so calls to the static fee calculator were made.
2017-05-15 20:26:11 -07:00
bryanvu
7768415adc test: change integration tests to assert amounts sent rather than balances.
This commit changes the SingleHop and MultiHop integration tests to
assert amounts sent rather than balances. Because fees can be odd
amounts, this change makes it such that fee amounts don't need to be
explicitly taken into account in the tests.
2017-05-15 20:26:11 -07:00
bryanvu
c1769f959b lnwallet: fix failure messages, spacing in tests
This commit changes t.Fatal to t.Fatalf in TestCheckDustLimit so as to
provide more information. This commit also makes some column width
adjustments and minor spelling/formatting changes.
2017-05-15 20:26:11 -07:00
Olaoluwa Osuntokun
bc1a228645
test: remove unnecessary sleep before pendingChannels query 2017-05-15 18:21:05 -07:00
Philip Hayes
3b84db1f25 rpc: add signature to VerifyMessage response 2017-05-12 14:21:19 -07:00
Philip Hayes
2249215260 rpc: add SignMessage and VerifyMessage interface
This commit allows users to sign messages with their node's private key
with the SignMessage interface. The signatures are zbase32 encoded for
human readability/paste-ability.  Others users can verify that a message
was signed by another node in their channel database with the
VerifyMessage interface.
2017-05-12 14:21:19 -07:00
Olaoluwa Osuntokun
31cb1cb65b
routing/chainview: linter fixes 2017-05-11 15:36:47 -07:00
Olaoluwa Osuntokun
98adeb6657
server: properly add user initiated persistent conns to persistentPeers map
This commit fixes a prior bug wherein if a user connected to a peer
using the —perm command, then once the peer was disconnected, we
wouldn’t automatically connect to them.
2017-05-05 15:57:14 -07:00
afederigo
1eaa522265 tests: add test case "disconnecting target peer"
Issue: 139

This commit contains test case "disconnecting target peer" (second test case) which takes two
connected peers, then checks via assert method one connection exists,
then disconnects this remote peer by passing pubKey parameter (just some string) into RPC-call method. Then checks 0
connection exists, and then connects disconnected peer for passing
further tests, and then checks one connection exists.
2017-05-05 14:24:25 -07:00
Olaoluwa Osuntokun
533cd69c7b
test: only assert pending close channels if didn't force close 2017-05-04 18:06:18 -07:00
Olaoluwa Osuntokun
3538dffe4e
test: add additional assertions to force close tests, verify pending channels 2017-05-04 17:41:00 -07:00
Olaoluwa Osuntokun
18a0849f3b
test: ensure channel shows up as pending close in closeChannelAndAssert 2017-05-04 17:40:54 -07:00
Olaoluwa Osuntokun
28e607b6ae
test: update funding persistence tests to check _open_ pending channels 2017-05-04 17:40:44 -07:00
Olaoluwa Osuntokun
7d02eedef2
test: factor in current chain during revoked close integration test
The recent multi-chain features resulted in a new directory structure
that wasn’t properly observed by the integration tests. This commit
fixes a prior bug that wouldn’t allow the test to copy the prior
revoked channels to the current state.
2017-05-02 20:38:13 -07:00
Olaoluwa Osuntokun
e947162d97
test: signal the process for exit before shutting down local goroutines
This commit is tied to the prior commit and it patches up a lingering
race condition and deadlock that can arise due to now properly waiting
for all goroutine  to exit before concluding the shutdown process.
2017-04-17 16:09:52 -07:00
Olaoluwa Osuntokun
b3424149ef
test: modify testNodeAnnouncment to not open channel, shutdown dave
This commit modifies the testNodeAnnouncment to no longer open a
channel for the duration of the test. As the test is only exercising
the proper behavior of announcement propagation and doesn’t require a
channel to be open for the duration. Also we now properly shutdown the
created “dave” node, as it’s no longer needed after the tests
concludes.
2017-04-16 15:27:32 -07:00
Olaoluwa Osuntokun
98d5dde9b2
test: expand timeout for peer restart+reconnect in persistent funding test 2017-03-29 19:00:34 -07:00
bryanvu
c9c2848427 server: user NodeAnnouncement addresses and ports for reconnect
Use addresses and ports from NodeAnnouncement messages for reconnection
attempts. For those nodes that don't explicitly report IP addresses, use
the IP address from previous connections connection request along with
the default peer port number.
2017-03-29 12:03:43 -07:00
bryanvu
085b7333cb lnwire: add support for Features in NodeAnnouncement
Add support for Features in NodeAnnouncment according to spec.
2017-03-29 12:03:43 -07:00
bryanvu
654c5ea61a config: added support, tests for --externalip config option
Minor change to server.go to add ExternalIPs to
channeldb.LightningNode. Also, added a test that utilizes this
functionality and exercises multiple addresses in NodeAnnouncement.
2017-03-29 12:03:43 -07:00
Olaoluwa Osuntokun
47c065b72c
rpc: re-implement QueryRoute as QueryRoutes 2017-03-21 12:20:52 -07:00
Andrey Samokhvalov
a423dc3e6c tests: add timeout in 'revoked uncooperative close retribution' test 2017-03-17 12:53:15 -07:00
Olaoluwa Osuntokun
e4e63eb3a3
test: remove many sleeps from integration test by using new topology ntfns
This commit removes a number of sleeps from the set of current
integration tests by replacing them with a synchronous (w/ a timeout)
block until one or many channels are detected as being open within the
network.

As a result, the tests are now more robust, many flakes have been
eliminated, and finally this shaves a few second off of the integration
testing runs.
2017-03-14 20:08:02 -07:00
Olaoluwa Osuntokun
a179a3adbb
test: modify new network announcement hook to be in node level
This commit modifies the two newly added network announcement hook stop
be at the lightningNode level rather than on the level of the entire
test framework. With this, callers are now able to better utilize the
newly added RPC’s since they can target particular peers and wait for
network messages to be processed rather then depending on a single node
(Alice) for information about the announcements propagated within the
network.
2017-03-14 20:07:52 -07:00
Olaoluwa Osuntokun
5623df6d7e
test: add integration tests for graph topology notifications 2017-03-14 20:07:49 -07:00
Andrey Samokhvalov
61991a1c89 lnd: fix latest goclean.sh lint warning 2017-03-13 16:30:23 -07:00
Olaoluwa Osuntokun
43f3b6bebe
test: log current edges in testMultiHopPayments on error 2017-03-08 14:22:34 -08:00
Olaoluwa Osuntokun
b91dae7eaf
test: expand funding persistence test to test >1 conf channel 2017-02-24 16:32:23 -08:00
bryanvu
d911107ec6 fundingmanager: Update tests for funding manager persistence
This commit adds the FundingManagerPersistence test to ensure that the
funding process completes as expected when nodes shutdown after the the
funding transaction has been broadcast. Note that the final parts of
several wallet tests have been removed, as functionality has been moved
to the Funding Manager and should now be tested there.
2017-02-24 11:37:33 -08:00
Olaoluwa Osuntokun
e910b12d33
lnd: fix issues reported by golint+govet
github.com/lightningnetwork/lnd  master ✗

                                           0m ◒
▶ golint
htlcswitch.go:292:4: should replace numUpdates += 1 with numUpdates++
htlcswitch.go:554:6: var onionId should be onionID
htlcswitch.go:629:7: var onionId should be onionID
lnd_test.go:133:1: context.Context should be the first parameter of a
function
lnd_test.go:177:1: context.Context should be the first parameter of a
function
networktest.go:84:2: struct field nodeId should be nodeID
peer.go:1704:16: should omit 2nd value from range; this loop is
equivalent to `for invoice := range ...`
rpcserver.go:57:6: func newRpcServer should be newRPCServer

github.com/lightningnetwork/lnd  master ✗

                                        9m ⚑ ◒  ⍉
▶ go vet
features.go:12: github.com/lightningnetwork/lnd/lnwire.Feature
composite literal uses unkeyed fields
fundingmanager.go:380: no formatting directive in Errorf call
exit status 1
2017-02-22 14:58:37 -08:00
Olaoluwa Osuntokun
026753bce4
test: add assertion within integration tests for proper preimage after send
In this commit we modify the testSingleHopInvoice test to ensure that
we obtain the proper preimage from the SendPayment RPC upon successful
payment completion.
2017-02-21 01:43:57 -08:00
Olaoluwa Osuntokun
a34df2f7d8
test: modify force close integration test to assert bob gets his balance
This commit adds a new assertion in the channel force closure test in
order to exercise the fix for a bug related to channel force closure
implemented in a prior commit. With this new assertion, we ensure that
bob is aware of his on-chain balance after a force channel closure
initiated by alice.
2017-02-07 20:54:11 -08:00
Olaoluwa Osuntokun
28aa092ac2
test: eliminate sleep by tightly polling for existence of node
This commit elminates a sleep in the testHtlcErrorPropagation test by
instead polling for the existence of our target in a tight loop. This
is a small patch over until we get a “topology client” within the
ChannelRouter. This method is robust and can be applied in future tests
until we get the notification client into the ChannelRouter.
2017-01-29 17:16:58 -08:00
Olaoluwa Osuntokun
f18a21fc54
test: correct error message for htlc error propagation test 2017-01-29 17:08:02 -08:00
Olaoluwa Osuntokun
07f8dab560
cmd/lncli: rename --draw to --render for describegraph 2017-01-29 15:38:28 -08:00
Olaoluwa Osuntokun
1ee4c661bc
server: optimize message broadcast+targeted send
This commit slightly optimizes the process of broadcasting a message to
a list of peers, and also sending a set of messages to a target peer.

When broadcasting a message to a set of target peers, we now launch a
goroutine for each send as to not block the ChannelRouter on an
individual send. When sending a set of messages to a target peer, we
now give up the mutex as soon as we’ve access the map, rather than
holding onto it until the sending is complete.
2017-01-29 15:03:05 -08:00
Olaoluwa Osuntokun
a658fabf48
funding: disallow channel creation before lnd is synced to the chain
This commit adds a new restriction around funding channels at the
daemon level: lnd nodes will not allow either the initiation or the
acceptance of a channel before the node is fully synced to the best
known chain.

This fixes a class of bug that arises when a new node joins the network
and either attempts to open a channel or has a channel extended to them
before the node is fully synced to the network.
2017-01-24 17:12:57 -08:00
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -08:00
Christopher Jämthagen
5c6d196ff8 test: reject non-standard transactions in integration tests 2017-01-17 16:23:50 -08:00
Olaoluwa Osuntokun
9662887d2f
rpcserver+cmd/lncli: implement DecodePayReq
This commit implements the newly added RPC to decode payment requests
passed over the command line or directly via gRPC.

With this tool, users can now examine payment requests they see in the
wild for diagnostic or debugging purposes.
2017-01-17 13:49:44 -08:00
Olaoluwa Osuntokun
dc280521dd
test: fix logging messages for funding push test 2017-01-16 17:08:56 -08:00
Olaoluwa Osuntokun
9ccf9947a2
test: add ability to push funds during funding to OpenChannel
This commit adds support for pushing funds during the funding process
to the helper method in the integration testing framework.

Additionally, we also modify the simple testBasicChannelFunding test to
also push over an amount in order to test the functionality within the
daemon.
2017-01-09 19:34:28 -08:00
Olaoluwa Osuntokun
d3612ac00a
test: let daemon create a new pre-image in the multi-hop test
If the RPreimage field is left off when adding a new invoice, the
daemon will create a new random pre-image itself for the requested
payment.
2017-01-07 21:22:29 -08:00
Olaoluwa Osuntokun
c61ea17df5
test: add an integration tests for multi-hop payment errors
With this commit we have gained a new interaction tests which excursus
all the possible multi-hop error cases aside from:
  * sphinx packet corruption

The case can’t be adequately tested with the current integration
testing framework as we can’t arbitrary modify packets en route to
peers within the proto test network. In a future commit, the p2p test
framework whcih has been started by andrew.shvv will be used to ensure
proper handling of this error.
2017-01-07 21:22:20 -08:00
Olaoluwa Osuntokun
387d41e5df
test: shutdown extra non "seed" nodes after tests they're created in
This commit ensures that any extra nodes that were created as part of
the integration tests are shutdown at the end of the test after it
completes successfully. This should speed up the tests as we’ll no
longer have lingering nodes in the background of the test consuming
resources.
2017-01-07 21:21:03 -08:00
Olaoluwa Osuntokun
573eb1dfc4
test: modify single hop invoice test to also test zpay32 payment requests
This commit adds an additional test case to the `testSingleHopInvoice`
test in order to exercise the proper parsing and dispatching of encoded
payment requests using the zpay32 encoding scheme.

With this test we ensure that the daemon properly encodes payreq’s upon
the creation of invoices, and also that the SendPayment RPC is able to
parse the payment request and properly complete a payment based off of
one.
2017-01-07 21:21:00 -08:00
bryanvu
24a99ade66 test: remove concurrent payment sends from testMultiHopPayments
testMultiHopPayments was failing intermittently due to a lack of
thread-safety in the gRPC stream. This commit takes payment sending out
of goroutines so that they execute serially.
2017-01-07 19:39:01 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
fb3bc04d65
test: mine enough blocks to active CSV+segwit in integration tests
As we’re switching to a more up to date btcd branch that properly
guards the activation of the soft-forks we rely on, we’ll also need to
ensure the two soft-forks have activated.
2017-01-05 13:18:37 -08:00
bryanvu
aa04f82a15 utxonursery: added persistence to transaction output states
Moved transaction states from in-memory maps to persistent BoltDB
buckets. This allows channel force closes to operate reliably if the
daemon is shut down and restarted at any point during the forced
channel closure process.
2017-01-03 16:23:07 -08:00
Olaoluwa Osuntokun
b991cd3d78
multi: allow force channel closures while not connected to peer
This commit adds a much needed feature to the daemon, namely the
ability to force close a channel while the source daemon doesn’t have
an active connection to the counter party. Previously this wasn’t
possible as ALL channel closures were routed through the htlcSwitch
which is only able to trigger a channel closure if the peer is online.

To remedy this, if the closure type is “force” then, we now handle the
channel closure and related RPC streaming updates from the call handler
site of the RPC itself. As a result, there are now only two htlcSwitch
channel closure types: breach, and regular. The logic that’s now in the
rpcSever should likely be refactored into a distinct sub-system, but
getting the initial functionality in is important.

Finally, the channel breach integration test has been modified to skip
connection the peers before attempting the forceful channel closure of
a revoked state as the remote peer no longer needs to be online.
2017-01-03 16:04:47 -08:00
Olaoluwa Osuntokun
57c0f8f005
test: add short sleep before channel assert to account for gossip propagation
This commit adds a short sleep before a channel assertion in the
`testMaxPendingChannels` test. This sleep serves to give the nodes
enough time to propagate the new channel announcement over the
authenticated gossip system. Without this sleep, the call may be issued
in a state wherein only half of the channel announcement has fully
propagated.
2017-01-02 15:47:02 -08:00
Olaoluwa Osuntokun
82815b703e
rpcserver: refactor logic for ListPayments/DeleteAllPayments
This commit slightly refactors the logic for the new outgoing payment
related RPC’s to more closely match the style of the rest of the
codebase. Additionally the tests have been updated to reflect the
changes to the protos of the new RPC’s.
2016-12-30 16:42:10 -08:00
Olaoluwa Osuntokun
2651541139
test: update integration tests to use DescribeGraph 2016-12-27 16:44:58 -08:00
BitfuryLightning
1c7f87c3f1
channeldb: refactor payments code
Go-fmt files. Refactored code according to the guidelines.
Enhanced payment test: add error checking
and individual context for each API call.
Add Timestamp field to payment struct.
2016-12-27 16:42:56 -08:00
BitfuryLightning
eb4d0e035e channeldb: save outgoing payments
Add structure for outgoing payments. Saving payment in DB
after successful payment send. Add RPC call for listing
all payments.
2016-12-27 16:16:23 -08:00
Olaoluwa Osuntokun
a88b093843
test: due to persistent conn retry, don't consider already connected an error 2016-12-14 18:24:16 -08:00
Andrey Samokhvalov
5a82240c6a lnwire+lnwallet+fundingmanager: general improvements 2016-12-13 11:01:57 -08:00
Olaoluwa Osuntokun
a6f7f05323
test: update integration test helper funds to latest btcrpcclient API 2016-12-12 15:57:22 -08:00
Olaoluwa Osuntokun
e0c09a016b
lnwallet: use stored initiator bool to properly construct close tx
This commit modifies the channel closing logic to remove the hard coded
bools indicating which side is attempting the closure. With the recent
changes, the initiator must always pay the channel closure fees.

This information is recently stored on disk, therefore we can use the
boolean to ensure that the closure transaction is created properly no
matter who initiates the close.

This fixes a bug.
2016-12-07 22:39:33 -08:00
Olaoluwa Osuntokun
494fcec874
breacharbiter: introduce new sub-system to watch for breaches
This commit introduces a new sub-system into the daemon whose job it is
to vigilantly watch for any potential channel breaches throughout the
up-time of the daemon. The logic which was moved from the utxoNursery
in a prior commit now resides within the breachArbiter.

Upon start-up the breachArbiter will query the database for all active
channels, launching a goroutine for each channel in order to be able to
take action if a channel breach is detected. The breachArbiter is also
responsible for notifying the htlcSwitch about channel breaches in
order to black-list the breached linked during any multi-hop forwarding
decisions.
2016-11-28 19:44:09 -08:00
Andrey Samokhvalov
5b9e4ae61e general: fix typos, rename variables, add comments 2016-11-23 20:02:29 -06:00
bryanvu
2bf5794645 lnrpc: added rpc support for querying a channel's satoshis sent/received
Added total_satoshis_sent and total_satoshis_received fields to the
ListChannels RPC call.
2016-11-22 14:57:03 -06:00
Olaoluwa Osuntokun
1199786498
test: ensure all invoices are unique
This commit modifies the invoices generated during the
testRevokedCloseRetribution integration test to ensure that the
invoices are globally unique within the context of the integration
tests.
2016-11-21 21:52:08 -06:00
Olaoluwa Osuntokun
6ff357686f
test: add integration test to excerise uncooperative channel breaches
This commit adds a new rather extensive integration tests to excerise
uncooperative channel breaches triggered by a counter-party
broadcasting a previously revoked commitment state.

In order to programmatically script such logic using the integration
testing framework, the test manually manipulates the database files of
one of the nodes within the test network in order to force Bob to
travel back in time to a revoked commitment state. With this
manipulation, we then force Bob to broadcast the revoked state,
triggering Alice’s retribution logic which sweeps ALL the funds within
the channel.
2016-11-21 21:17:00 -06:00
Olaoluwa Osuntokun
5e5bc3884a
test: modify closeChannelAndAssert to allow force close, return txid 2016-11-21 21:13:12 -06:00
Olaoluwa Osuntokun
8608ffba15
test: cancel the daemon panic goroutine after interaction tests 2016-11-16 12:43:08 -08:00
Olaoluwa Osuntokun
f12b9b4bd7 Merge pull request #66 from AndrewSamokhvalov/temporary_fix_multihop
Temporary fix multihop
2016-11-08 14:58:01 -08:00
Andrey Samokhvalov
6d57fb08b3 tests: temporary fix multi hop test 2016-11-08 12:33:10 +03:00
Andrey Samokhvalov
75dd860ac9 tests: fix defer+goroutine by returning previous test structure (without goroutine) 2016-11-08 11:41:16 +03:00
Olaoluwa Osuntokun
d181aad8e2
test: use *testing.T directly outside of test execution 2016-10-23 20:04:05 -07:00
Olaoluwa Osuntokun
517255fdb1
test: rename CT to harnessTest, ensure all RPC's get distinct timeouts
This commit slightly modifies the existing CT struct in order to
maintain consistency with code-style. As a result of the name change,
all references have also been renamed from `ct` to `t`.

The Error and Errorf methods have been removed in favor of forcing
everything to be reported via `Fatalf`. Additionally a new method
(ProcessErrors) has been introduced to the networkHarness class in
order to encapsulate the underlying channel.
2016-10-23 19:27:24 -07:00
Andrey Samokhvalov
7196c4bb1c fundingmanager: add max pending channel check 2016-10-22 02:15:35 +03:00
Andrey Samokhvalov
e6f45a948e testing: add CT (Custom Testing) structure; create uniq point for 'lnd process errors' and 'test panic/failed errors' handling 2016-10-22 02:11:12 +03:00
andrew.shvv
56ab64ecab test: add basic test for multi-channel opening+closing 2016-10-16 21:36:43 -07:00
Olaoluwa Osuntokun
79e7862525
test: add integration tests for invoice settle/add notifications 2016-10-15 14:46:12 -07:00
Olaoluwa Osuntokun
80d38d6bbc
test: add network test case for repeated multi-hop invoice payments 2016-09-26 10:42:02 -07:00
Olaoluwa Osuntokun
bf0945a6bf
test: add test case for a simple one-hop invoice scenario 2016-09-26 10:41:05 -07:00
Olaoluwa Osuntokun
e6ced8ee7a
test: ensure tests nodes are started with the debughtlc flag 2016-09-21 19:49:21 -07:00
Olaoluwa Osuntokun
28b72d368c
test: use context.WithTimeout to ensure async tests don't block indefinitely
This commit uses the context package’s WithTimeout to ensure tests
which rely on asynchrony behaviors cannot block the execution of the
integration tests for ever. All tests which rely on async gRPC
notifications now perform a 3 way select: on the timeout channel
closure, an error, and the response itself.

Additionally some slight refactoring has taken place within the current
set of integration tests, eliminating some unneeded factory functions.
2016-09-21 19:45:54 -07:00
Olaoluwa Osuntokun
255b1b7727
test: fix some minor typos, expand comments 2016-09-15 12:25:10 -07:00
andrew.shvv
2788dbeaa8 Add RPC to show current total available channel capacity #29 (#35)
This commit adds a new RPC command: `channelbalance` which returns the
sum of all available channel capacity across all open channels. The
total balance is currently returned in units of `satoshis`. Additionally
the `networkHarness` has been modified slightly to allow specifying the
additional "extra" command line parameters when creating the initial
seed nodes. Minor refactoring within the integration tests has been
undertaken in order to increase code re-use across tests.

Closes #29.
2016-09-15 12:00:56 -07:00
Olaoluwa Osuntokun
4c01e42670
test: add integration tests for forced channel closure
This commit adds a basic test to exercise the scenario of forced
channel closure between to nodes with an existing channel open. The
test ensures that the latest commitment transaction it broadcast to the
chain and additionally that all time-locked outputs are sweeped with a
single transaction as soon as the inputs are mature enough.
2016-09-13 19:00:57 -07:00
Olaoluwa Osuntokun
d2acb4336c
test: add method to dump logs of a node within the networkHarness
At times when testing one requires access to the logs of a particular
node in order to aide with debugging. Before this commit, one needed to
manually modify the networkHarness code in order to print either the
location of the logs or the logs themselves. With this commit, tests
can now programmatically examine the logs of any node created within
the networkHarness.

It’s worth noting that at times the logs dumped may not be the most up
to date version of the logs files as the logging library employs
intermediate buffering.
2016-09-10 13:14:33 -07:00
Olaoluwa Osuntokun
d764493d25
test: fix basic funding integration test flakiness
This commit fixes some flakiness exhibited in the current basic funding
workflow tests. This test can fail occasionally in resource constrained
environment due to a race condition which arises after Alice learns of
the channel, but Bob is still waiting for Alice’s notification. As a
temporary fix, we now only check Alice’s state for the existence of the
channel.
2016-09-06 12:04:18 -07:00
Olaoluwa Osuntokun
83bf0be2cc
test: introduce a few networkHarness helper methods
This commit adds some new networkHarness helper methods which are
mean’t to reduce the verbosity of the previous basic tests, and also to
enable developers to right tests mote easily five a higher level
interface.
2016-08-31 11:59:25 -07:00
Olaoluwa Osuntokun
62c426fe75
test: update the funding test to use new async updates/notifications
This commit increases the robustness of the current test and also
reduces it’s running time considerably as all “time.Sleep”s have now
been removed.

Rather than sleeping some random amount of time, the test now waits for
a particular async notification to be dispatched before proceeding.
This tightens up the execution of the tests quite a bit.
2016-08-30 19:36:48 -07:00
Olaoluwa Osuntokun
95380fee1b
test: add async txn seen notifications to network harness
This commit adds a new feature to the network harness enabling callers
to receive async notifications once a particular transaction is seen on
the network. Such a feature is useful when due to the asynchronous
behavior of node communications.

With this new feature, tests can now wait for a particular transaction
to be seen within the network before proceeding.
2016-08-30 19:34:25 -07:00
Olaoluwa Osuntokun
1ace7ede01
lnd: fix build for Go 1.6.3, refer to old context package
This commit fixes the build for version 1.6.3 of golang. In go 1.7, the
“context” package was moved into the standard library, however go 1.6.3
doesn’t have that change, so we must refer to the prior WIP package
until a new version of Go is released.
2016-08-30 11:12:38 -07:00
Olaoluwa Osuntokun
b21c8eccf0
lnd: add basic integration test using the networkHarness
This commit adds an initial integration test to the project which
exercises some basic channel opening/closing functionality between two
lnd nodes.
2016-08-29 22:08:00 -07:00