Commit Graph

189 Commits

Author SHA1 Message Date
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