Commit Graph

1014 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
e60f40b845
lnwallet: fix bug with funding channels with 50/50 balances
This commit fixes a prior bug in the wallet triggered by the creation
of a channel using the single funder workflow, but pushing exactly
*half* of the channel over to the other side. The prior logic to
determine who the initiator would result in a disagreement over who
created the channel initially. This wouldn’t manifest until the channel
was attempted to be closed cooperatively. As both side disagreed about
who created the channel they would apply the closing fee to different
outputs, thereby creating mismatched closing transaction. The signature
would fail to validate as the closer will create a different
transaction from that of the responder.

This commit fixes the issue by properly detecting who initially created
the channel.
2017-01-16 20:28:38 -08:00
Olaoluwa Osuntokun
f82d957c90
lnwire+peer: introduce new error for unknown message type for forward compat
This commit adds a new error type to the `lnwire` package:
`UnknownMessage`. With this error we can catch the particular case of a
an error during reading that encounters a new or unknown message. When
we encounter this message in the peer’s readHandler, we can now
gracefully handle it by just skipping to the next message rather than
closing out the section entirely.

This puts us a bit closer to the spec, but not exactly as it has an
additional constraint that we can only ignore a new message if it has
an odd type. In a future release, we’ll modify this code to match the
spec as written.
2017-01-16 18:03:43 -08:00
Olaoluwa Osuntokun
6405b1c8b3
glide: pin sphinx package dependency at the commit level
With this commit we now pin the version of lightning-onion we build
against at a particular build on the Sphinx package as the package will
be modified in order to accommodate for future changes in the spec.
2017-01-16 17:41:20 -08:00
Olaoluwa Osuntokun
d7a050b353
config: remove deprecated configuration parameters 2017-01-16 17:29:17 -08:00
Olaoluwa Osuntokun
dc280521dd
test: fix logging messages for funding push test 2017-01-16 17:08:56 -08:00
Olaoluwa Osuntokun
c40cb496e1
build: update glide.lock to latest commit hashes 2017-01-14 19:46:49 -08:00
Olaoluwa Osuntokun
55f89be10f
lnwallet+lnd: ensure curve parameters are set to avoid panics
This commit fixes a bug introduced by the past attempt to Make Logging
Great Again. Since we unset the curve parameters when reading/writing
the messages, if we have a lingering reference that’s active elsewhere
in the daemon, then we’ll modify that reference. To fix this, we now
explicitly set the Curve parameters in two areas.

A similar commit has been pushed to lightning-onion.
2017-01-14 19:44:37 -08:00
Olaoluwa Osuntokun
ee96052e44
cmd/lncli: add parsing+dispatch for the debuglevel command 2017-01-14 18:20:12 -08:00
Olaoluwa Osuntokun
99c1ef6210
lnd: add additional logging statement on payment recv 2017-01-14 18:18:15 -08:00
Olaoluwa Osuntokun
012480be98
rpcsever: implement DebugLevel command 2017-01-14 18:16:59 -08:00
Olaoluwa Osuntokun
6beaa7fff5
lnrpc: add DebugLevel command 2017-01-14 18:14:12 -08:00
Olaoluwa Osuntokun
9b4ac77d40
rpcserver: allow channels to be opened using --node_id
This commit fixes a slight bug in the interaction between the cli
program and the rpcsever itself. With this commit it’s now again
possible to create a channel with a peer that’s identified by its
peerID, instead of only the pubkey.
2017-01-14 18:12:28 -08:00
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