Commit Graph

9102 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
8990de4d99
breacharbiter: ensure failure to retrieve channels triggers start-up error
This commit moves the fetching of active channels from the
contractObserver goroutine up to the Start() method on the
breachArbiter. By doing this, we ensure that the user receives an error
(under the current set up) if the btcd node that lnd is connected to
doesn’t have their txindex enabled.
2017-01-14 18:03:51 -08:00
Olaoluwa Osuntokun
ae72475612
lnwallet: create channel close summary when commitment broadcast detected
This commit modifies the closeObserver goroutine to ensure that a close
summary has been inserted into the database before signalling any
observers that a unilateral channel closure was detected. This fixes a
slight bug where a peer would force close a channel, but we wouldn’t
properly detect that and clean up the channel state if had a failed
cooperative channel closure.
2017-01-14 18:01:28 -08:00
Olaoluwa Osuntokun
1e8a80170f
docs: update INSTALL.md with new btcd commit hash, correct instructions 2017-01-14 17:53:36 -08:00
Olaoluwa Osuntokun
d884efea29
lnwire+lnd: Make Logging Messages Great Again
This commit modifies the login of sent/recv’d wire messages in trace
mode in order utilize the more detailed, and automatically generated
logging statements using pure spew.Sdump.

In order to avoid the spammy messages due to spew printing the
btcec.S256() curve paramter within wire messages with public keys, we
introduce a new logging function to unset the curve paramter to it
isn’t printed in its entirety. To insure we don’t run into any panics
as a result of a nil pointer defense, we now copy the public keys
during the funding process so we don’t run into a panic due to
modifying a pointer to the same object.
2017-01-14 17:52:18 -08:00
Olaoluwa Osuntokun
0bfdcde969
rpcserver: include encoded payment requesting ListInvoices response 2017-01-12 18:52:40 -08:00
Olaoluwa Osuntokun
d79530e25d
lnrpc: add encoded payment requests to the ListInvoices response
This commit modifies the ListInvoice RPC to also return the encoded
payment request in the response. With this change it’ll be possible to
always obtain the encoded payment for any invoice, rather than only
being able to obtain it directly after the creation of an invoice.
2017-01-12 18:51:49 -08:00
Olaoluwa Osuntokun
6a67d4848a
lnrpc: add CloseChannel to README description of RPC calls 2017-01-12 18:51:21 -08:00
Olaoluwa Osuntokun
eb1509a1cf
funding: properly display channel funding point in handleFundingOpen 2017-01-12 18:31:21 -08:00
Olaoluwa Osuntokun
ff74d83277
build: add release script 2017-01-12 18:30:47 -08:00
Olaoluwa Osuntokun
c451258fd2
lnwallet: properly detect initiator cooperative close in closeObserver
This commit modifies the logic of the closeObserver slightly to not
incorrectly mark the broadcast of the commitment transaction triggered
by a cooperative channel closure as an unprompted broadcast.
2017-01-12 18:30:07 -08:00
Olaoluwa Osuntokun
e057684c8e
travis: update build to go1.7.4 2017-01-12 17:14:41 -08:00
Olaoluwa Osuntokun
a070d4131f
docker: add example output to commands in workflow 2017-01-12 17:13:18 -08:00
Andrey Samokhvalov
299217aecb README: reformat and add IRC badge 2017-01-12 16:43:55 -08:00
Andrey Samokhvalov
a421069dd8 docker: add send payment alice->bob workflow for newcomers 2017-01-12 16:43:55 -08:00
Andrey Samokhvalov
51d53eab32 test: fix typos 2017-01-12 16:43:55 -08:00
Trevin Hofmann
a13ac90d46 multi: add link to LICENSE in README license badges (#100) 2017-01-12 16:31:08 -08:00
Christopher Jämthagen
cc4617ca23 chainntnfs: break out of loop once txIndex is found 2017-01-11 15:51:19 -08:00
Christopher Jämthagen
95888613d0 multi: minor fixes for README's 2017-01-11 15:50:22 -08:00
Olaoluwa Osuntokun
4ccdad0d66
multi: add README's for all sub-packages 2017-01-10 15:02:37 -08:00
Olaoluwa Osuntokun
e37b848f36
README: update readme to latest project state 2017-01-10 12:23:56 -08:00
Olaoluwa Osuntokun
f1e23748c9
routing/testdata: ensure test channels have unique chan ID's
This commit fixes a bug in the test data that was uncovered due to the
recent bug fix within the AddChannelEdge method within the ChannelGraph
struct of channeldb.

The storage and assertion of unique channel ID’s wasn’t correct due to
bug in the channeldb which caused the defect in the test data to go
unnoticed.
2017-01-09 19:47:52 -08:00
Christopher Jämthagen
a9449b876c docs: minor fixes 2017-01-09 19:37:49 -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
bc885f5f27
brontide: modify key rotation to match test vectors in spec
This commit modifies our key rotation slightly to match the test
vectors within the BOLT08 specifications. Before this commit, we were
rotating one message before the rest of the implementers. This
implementation divergence was possibly due to the section of the spec
describing the rotations being a bit ambiguous.

A future PR to the lightning-rfc repo will make the spec more explicit
to avoid situations like this in the future.
2017-01-09 19:12:48 -08:00
Olaoluwa Osuntokun
efa7059ac3
cmd/lncli: add support for new "Perm" field in connectpeer command 2017-01-09 19:12:42 -08:00
Olaoluwa Osuntokun
8cdb84c619
lnd: add new "perm" bit to the ConnectPeer RPC call
This commit modifies the ConnectPeer RPC call and partitions the
behavior of the call into two scenarios: the connection should be
persistent which causes the call to be non-blocking, and the connection
should only attempt to connect once — which causes the call to be
blocking and report any error back to the caller.

As a result, the pendingConnRequest map and the logic around it is no
longer needed.
2017-01-09 19:09:03 -08:00
Olaoluwa Osuntokun
b01e7efcef
cmd/lncli: add cli support for the push-during-funding workflow 2017-01-09 19:06:15 -08:00
Olaoluwa Osuntokun
9965640349
lnd: add support for pushing funds as part of channel funding
This commit adds daemon level support for pushing funds as part of the
single funder channel workflow. This new feature allows the user to
open a channel and simultaneously make a channel at the same time which
can improve the UX when setting up a channel for the first time.
2017-01-09 19:05:36 -08:00
Olaoluwa Osuntokun
5f2f77e873
channeldb: fix typo in AddChannelEdge 2017-01-09 19:02:37 -08:00
Olaoluwa Osuntokun
a1d584f1b2
lnrpc: recompile protos 2017-01-09 19:01:10 -08:00
Olaoluwa Osuntokun
c4d53f934f
lnrpc: remove remote_funding from OpenChannel, add push_sat
This commit removes the remote_funding field from the OpenChannel
message as dual funding channels aren’t yet supported at the wire level
within the spec (although the daemon is able to handle them properly).
In place we now add the ‘push_sat’ field which allows the initiator to
push over a certain amount to the responder as part of the initial
state.
2017-01-09 19:00:46 -08:00
Olaoluwa Osuntokun
d7e3b090c5
lnrpc: add ability to toggle persistent connections for ConnectPeer 2017-01-09 19:00:40 -08:00
Olaoluwa Osuntokun
285ba711a1
lnwallet: add support for the push-during-funding workflow
This commit adds support to the wallet’s internal funding workflow for
pushing a certain amount of BTC to the responder’s side for a single
funder workflow as part of the first commitment.
2017-01-09 18:58:07 -08:00
Olaoluwa Osuntokun
35776a9906
lnwire: add new 'PushSatoshis' field to SingleFundingRequest
This commit adds a new paramter to the initial channel creation:
‘PushSatoshis’. This new field allows the funder of a channel to push
over a certain amount to the responder as part of the initial channel
state. This ability creates a new streamlined UX of finalizing a
payment as a part of the channel creation.
2017-01-09 17:24:32 -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
ec0c7c5989
routing: fix panic in inner loop of path finding
This commit seems to fix a sporadic error within the integration tests
which would at times cause a panic when a payment as initiated.

This issue was with the way were deleting from the middle of the slice
of unvisited nodes within the graph. Assigning the last element to the
middle would at times cause a panic the last element may be nil. To fix
this, we now manually copy every item over by one, preserving the order
of the slice, and possibly fixing the panic once and for all.
2017-01-07 21:22:23 -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
6bd0e068c6
peer+htlcswitch: add support for multi-hop HTLC error propagation
This commit adds a critical capability to the daemon: proper handling
of error cases that occur during the dispatch and forwarding of
multi-hop payments.

The following errors are now properly handled within the daemon:
    * unknown payment hash
    * unknown destination
    * incorrect HTLC amount
    * insufficient link capacity

In response to any of these errors, an lnwire.CanceHTLC message will be
back propagated from the spot of the error back to the source of the
payment. In the case of a locally initiated HTLC payment, the error
will be propagated back to the client which initiated the payment.

At this point, proper encrypted error replies as defined within the
spec are not yet implemented and will be fully implemented within a
follow up PR.
2017-01-07 21:22:17 -08:00
Olaoluwa Osuntokun
60914029da
htlcswitch: use an atomic load for link bandwidth during local dispatch 2017-01-07 21:22:14 -08:00
Olaoluwa Osuntokun
a89de14c69
htlcswitch: clear onion index for link during de-registration
This commit fixes an unnoticed bug within the htlcSwitch. Previously
when a peer when offline, the interface+links for that particular peer
were removed from the HTLC switch so we wouldn’t dispatch immediate
HTLC’s in that direction. However, the onion index for that interface
wasn’t also cleared. This would result in a deadlock when a payment
were to be attempted to be forwarded to a peer who recently went
offline.

To fix this issue, we now properly purge the onionIndex of the entry
corresponding to the interface that has gone offline.
2017-01-07 21:22:11 -08:00
Olaoluwa Osuntokun
cee05eb45e
channeldb: fix minor typo 2017-01-07 21:22:08 -08:00
Olaoluwa Osuntokun
ccb12ab0a8
utxonursery: add additional comments to new sections 2017-01-07 21:22:05 -08:00
Olaoluwa Osuntokun
c9dbaa1403
lnwallet: include r-hash of canceled htlc in log entry for cancel
This commit modifies the logic around adding cancel entries to the
update log for the commitment state machine slightly by also including
the r-hash of the HTLC that’s been cancelled in the entry for the
cancellation. With this change, we can accurately track which HTLC is
being cancelled within outer sub-systems.
2017-01-07 21:22:01 -08:00
Olaoluwa Osuntokun
81767eb8fd
lnwire: add IncorrectValue as HTLC error type, fix typos
This commit adds a new HTLC error type: IncorrectValue. This error type
is to be used when an HTLC that’s extended to the final destination
does not match the expectation of the destination.
2017-01-07 21:21:58 -08:00
Olaoluwa Osuntokun
219c79e726
rpcserver: don't error out in ListChannels if unable to retrieve chanID 2017-01-07 21:21:55 -08:00
Olaoluwa Osuntokun
d046efb502
brontide: exclude MAC length from cipher text packet length prefix
Pervasively we would include the length of the MAC in the length prefix
for cipher text packets. As a result, the MAC would eat into the total
payload size. To remedy this, we now exclude the MAC from the length
prefix for cipher text packets, and instead account for the length of
the MAC on the packet when reading messages.
2017-01-07 21:21:52 -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
Olaoluwa Osuntokun
9bb5a45f89
lnwallet: the canceller of an HTLC targets by payment hash not index
This commit alters the new HTLC cancellation logic to instead allow the
canceller of an HTLC to cancel the HTLC by the payment hash rather than
the index of the HTLC.
2017-01-07 21:20:57 -08:00
Olaoluwa Osuntokun
d079c88702
lnwire: add cancellation reason to htlc cancel messages
This commit adds a new field to the CancelHTLC message which describes
the event that led to an HTLC being cancelled up stream.

A new enum has been added which describers the “why” concerning the
cancellation of the HTLC. Currently the encoding and back propagation
of the errors aren’t properly implemented as defined within the spec.
As a result the current error types provide to privacy as the error are
in plain-site rather doing being properly encrypted.
2017-01-07 21:20:54 -08:00