Commit Graph

962 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun fd0c0574e6
lnwallet: add send/recv of HTLC cancellations to state machine
This commit adds the ability to send/recv HTLC cancellation to the
commitment state machine. Previously this feature had been
unimplemented within the state machine, with only adds/settles working.

With this change, there’s now now no concept of “timing” out HTLC’s,
only the cancellation of HTLC’s which may be triggered for various
reasons.
2017-01-07 21:20:51 -08:00
Olaoluwa Osuntokun 4e53cf8b49
lnwallet: correct error message in txn subscription test 2017-01-07 21:20:47 -08:00
bryanvu 35cf21733d chainntnfs: exit notifyBlockEpochs upon shutdown
On restarts, notifyBlockEpochs would intermittently attempt to send new
block epoch notifications to clients that had already been shut down,
causing a “send on closed channel” error. This change exits
notifyBlockEpochs upon shutdown so as to prevent this.
2017-01-07 19:39:01 -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
Alex 89c772aac3 README: fix some typos 2017-01-05 16:42:43 -08:00
Alex e91c1b8136 docs: add installation instructions 2017-01-05 16:42:43 -08:00
Olaoluwa Osuntokun d7b36c6f31
build: update glide dependancies since roasbeef/btcsuite upstream merge 2017-01-05 14:08:43 -08:00
Olaoluwa Osuntokun 3741ae1d4c
lnd: fix lingering connmgr import 2017-01-05 14:08:36 -08:00
Olaoluwa Osuntokun 594dc1b163
lnd: switch to the version of the connmgr in roasbeef's fork 2017-01-05 13:58:11 -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 5d37c1d9e7
uspv: remove package as it's no longer actively used within the project 2017-01-05 13:27:14 -08:00
Olaoluwa Osuntokun 798b0b9c9f
utxonursery: minor post-merge formatting clean ups
This commit implements so minor changes in formatting: character column
limits, error returning, scoped, errors. The aforementioned changes are
a bit of minor clean up after the merge of the latest PR in order to
ensure the new code in the file conforms to the code style in the rest
of the project.
2017-01-05 13:25:55 -08:00
Olaoluwa Osuntokun beb6303e2f
breacharbiter: only log if we have any active channels
This commit modifies the contractObserver slightly to along log if we
have any active channels, which avoids a meaningless log message.
2017-01-05 13:21:47 -08:00
Olaoluwa Osuntokun 5957725975
lnwallet: mine enough blocks to activate CSV+segwit in reservation tests 2017-01-05 13:20:37 -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
Olaoluwa Osuntokun ad76899a57
config+test: use default port for RPC server if one isn't specified
This commit alters the configuration parsing a bit along with the
documentation to expect the RPCHost configuration paramter to also have
the target port specified. If the port isn’t included, then the default
btcd RPC port for that chain is used.

Additionally, within the integration testing framework, when creating
the lnd nodes, we now use the configuration from the btcd harness to
set the proper RPC host.
2017-01-05 13:18:26 -08:00
Olaoluwa Osuntokun 8fe5c09e21
lnd: remove support for the now obsolete SegNet4 2017-01-05 13:08:15 -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
bryanvu 90ed23e6aa chainntnfs: fixed off-by-one in attemptHistoricalDispatch 2017-01-03 16:23:07 -08:00
bryanvu def39799c5 chainntnfs: handling for potential deadlocks during system shutdown
If the lnd daemon is shut down while multiple subsystems are attempting
to register for notifications, the blocking of those chain notifier
registrations may cause the daemon shutdown to deadlock. The additions
in this commit allow the registration functions to return errors rather
than potentially deadlock when the chain notifier is shut down.
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 9b50df704c
cmd/lncli: accept zpay32 requests in sendpayment command 2017-01-02 15:46:54 -08:00
Olaoluwa Osuntokun 5a9be3f812
cmd/lncli: display zpay32 request in addinvoice response 2017-01-02 15:37:16 -08:00
Olaoluwa Osuntokun 19bf044bdb rpcserver: accept+parse encoded zpay32 requests in SendPayment 2017-01-02 15:36:15 -08:00
Olaoluwa Osuntokun 5d655ea332
rpcserver: disallow zero valued invoices 2017-01-02 15:35:28 -08:00
Olaoluwa Osuntokun fce366894d
rpcserver: return an encoded payment request in AddInvoice
This commit modifies the generated response to an “AddInvoice” RPC by
including an encoded payment request in the response. This change gives
callers a new atomic piece of information that they can present to the
payee, to allow completion of the payment in a seamless manner.
2017-01-02 15:34:53 -08:00
Olaoluwa Osuntokun ca84c620ea
lnrpc: return encoded payReq in AddInvoice, accept payReq's in SendPayment 2017-01-02 15:31:44 -08:00
Olaoluwa Osuntokun bd0cf51581
zpay32: create new package for encoding/decoding payment requests
This commit adds a new package “zpay32”: which is used within the
daemon to encode/decode payment requests. A payment request currently
consists of: the public key of the payee, the payment hash to use, and
finally the amount to send over the network. The encoded payment
request consists of the mentioned fields concatenated to each other, a
cc32 checksum is added, then the blob is finally encoded using zbas32.
I call the resulting scheme “zpay32”.

A number of extensions may be explored in future commits including
adding a version byte, adding “hint” routing information,
cryptographically signed receipts and more,
2017-01-02 15:17:58 -08:00
Olaoluwa Osuntokun d2e712c19d glide: update build dependancies 2016-12-30 16:44:51 -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 480fd8d03f
lnrpc: rename r_hash to payment_hash in Payment message 2016-12-30 16:38:54 -08:00
Olaoluwa Osuntokun 630afbdc93
channeldb: don't return error from HasChannelEdge if single edge doesn't exist
This commit modifies the error propagating behavior within the
HasChannelEdge struct. Rather than exiting the function early when a
single edge isn’t found, we instead continue to also possibly retrieve
the second directional edge.

With this change, we avoid a potential infinite gossiping loop in the
routing package that would result if we’d seen one edge but not the
other. In this case the timestamps returned for *both* edges would
always be zero, causing the daemon to always accept and rebroadcast the
announcement putting all other connected lnd’s into the same loop.
2016-12-30 16:35:30 -08:00
Olaoluwa Osuntokun f7510cf1fc
channeldb: modify new payments module to match project code-style
This commit modifies the new payment module within the database to
match the coding style of the rest of the package and the project as a
hole. Additionally, a few fields have been renamed, and the extra
timestamp added to the OutgoingPayment struct has been removed as
there’s already a CreationTime field within the Invoice struct that’s
embedded within the OutgoingPayment struct.
2016-12-30 16:32:25 -08:00
Olaoluwa Osuntokun 276c384455
breacharbiter: fix double channel close panic bug
This commit fixes s bug in the breachArbiter which was introduced
during the change that added the live channel hand off from an active
peer. Rather than closing the settle channel of the _older_
breachObserver, the settle channel of the newer beachObserver was being
closed. This would result in a panic once the channel itself was
actually settled as the channel would be closed again.

To fix this bug, we now properly close the channel of the old settle
signal instead of the new one.
2016-12-30 16:30:11 -08:00
Olaoluwa Osuntokun 0585ed93be
lnwallet: use in-memory height within channel's closeObserver
This commit partially rectifies a quick hack that was previously thrown
in to address an issue discovered due to possible state inconsistencies
between an active channel object and the daemon’s breachAbrbiter.

A prior commit has modified the interaction between the peer and the
breachArbiter to eliminate the state in consistency. Therefore, we no
longer need to access the database to ensure that we’re observing the
latest channel state in order to correctly make a decision about
whether a broadcast commitment transaction is a breach or not.
2016-12-27 16:45:10 -08:00
Olaoluwa Osuntokun 3e1c98f2f7
breacharbiter: accept handoff for live channel on peer connect
This commit modifies the interaction between the breachArbiter and the
peer struct such that the breachArbiter _always_ has the latest version
of a contract.

Prior to this commit once we connected out to a peer which we had an
active contract with and the breachArbiter was watching, we’d have two
copies of the channel in memory, instead of just a single one. This was
wasteful and caused some duplicated log messages due to two instances
of the channel being active.
2016-12-27 16:45:05 -08:00
Olaoluwa Osuntokun 507a4eb5cc
cmd/lncli: add support for the net channel graph related commands
This commit adds support for the newly added channel graph related
commands: describegraph, getchaninfo, getnodeinfo, queryroute, and
finally getnetworkinfo.
2016-12-27 16:45:02 -08:00
Olaoluwa Osuntokun 367be2d385
lncli: remove deprecated shell command
This commit removes the shell command as it’s now deprecated since it
was never fully implemented.
2016-12-27 16:45:00 -08:00
Olaoluwa Osuntokun 2651541139
test: update integration tests to use DescribeGraph 2016-12-27 16:44:58 -08:00