Commit Graph

1308 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
7bdf02bc9e
routing: modify path finding routines use new EdgeInfo/EdgePolicy
This commit modifies the path finding routines to properly use the new
channel edge related API exposed by the database. Additionally, a new
type `ChannelHop` has been introduced which couples an edges routing
policy with the capacity and origin chain of the channel.
2017-03-08 14:25:05 -08:00
Olaoluwa Osuntokun
43f3b6bebe
test: log current edges in testMultiHopPayments on error 2017-03-08 14:22:34 -08:00
Olaoluwa Osuntokun
da09f4dcc4
lnwire: modify newAlias to truncate alias strings if too long 2017-03-08 14:21:57 -08:00
Olaoluwa Osuntokun
f881e0a356
lnwire: fix typo in ChannelUpdateAnnouncement, Mstat -> Msat 2017-03-08 14:20:14 -08:00
Olaoluwa Osuntokun
1e540b0f99
funding: modify channel announcements due to lnwire API change 2017-03-05 22:46:59 -06:00
Olaoluwa Osuntokun
743de45c92
lnwire: rename Expiry to TimeLockDelta within ChannelUpdateAnnouncement
This commit modifies the ChannelUpdateAnnouncement to rename the Expiry
variable instead of TimeLockDelta as that is more descriptive of the
purpose of the attribute itself.
2017-03-05 22:43:57 -06:00
Olaoluwa Osuntokun
dc5eb8de37
rpc: update graph topology related RPC's to recent db API change
This commit updates all the RPC’s that deal with querying for data
stored within the graph to the latest version of the public API for the
graph itself.
2017-03-05 19:28:17 -06:00
Olaoluwa Osuntokun
d8d7dab258
rpc: set PaymentRequest+CreationDate in LookupInvoice respones 2017-03-05 19:26:52 -06:00
Olaoluwa Osuntokun
39e145f037
channeldb: update tests to recent API change (edge struct split) 2017-03-05 19:22:33 -06:00
Olaoluwa Osuntokun
deceae8fe4
channeldb: PruneGraph now returns the channels closed
This commit alters the return value of PrunedGraph to me a bit more
useful: the function now returns all the channels that were closed when
processing the block (slice of spent outpoints). With this information,
callers gain greater visibility into exactly which channels were
closed. This can be used in higher levels to present detailed summaries
of how blocks affect closed channels.
2017-03-05 19:20:57 -06:00
Olaoluwa Osuntokun
2c29a20a8d
channeldb: split ChannelEdge into two structs, info and policy
This commit splits the prior ChannelEdge struct into two distinct
structs: ChannelEdgeInfo and ChannelEdgePolicy. The info structs stores
the _full_ information that was used to advertise the channel, while
the policy struct contains the information that’s needed in order to
use the information for routing purposes.

With this split we can eliminate a number of hacks within the rest of
the codebase that were added as a result of data unavailability if one
or neither edge was present.

Finally a bit of field renaming has taken place (Exipiry ->
TimeLockDelta), etc.
2017-03-05 19:18:34 -06:00
Olaoluwa Osuntokun
8387092409
cmd/lncli: fix bug in openchannel cmd that made --push_amt mandatory
This commit fixes a minor bug that was introduced with the latest PR
that made specifying the —push_amt flag when opening a channel
mandatory. The fix is simple, turn the switch statement into an
if/else, which makes the —push_amt flag optional once again.
2017-03-05 19:01:01 -06:00
Thomas Preindl
355c88f5a4 lncli: add support for positional arguments for all commands (#120)
This commit updates the command line help for several commands within
cmd/lncli to be more uniform, and also use the proper attributes within
the urfave/cli project. Additionally, in several areas cli.Int was using
used instead of cli.Int64 when parsing satoshis. This oversight has been
rectified by modifying all incorrect occurrences.

Finally, this commit, as its central contribution, adds the ability to mix
and match positional arguments with key-word arguments for several
commands! The following commands can now be used with either only
positional arguments, only key-word arguments, or a mix of both when
applicable:
  * openchannel 
  * closechannel
  * sendpayment
  * getnodeinfo
  * getchaninfo
  * newaddress
  * sendcoins
  * sendmany
  * connect
  * addinvoice
  * lookupinvoice
  * queryroute


The set of changes outlined above should make command line tinkering with
`lnd` a bit more streamlined, yet still very flexible.
2017-03-02 16:23:16 -06:00
Michiel de Jong
2841d8f503 docker: fix small typos in README.md 2017-02-28 19:33:59 -06:00
Michiel de Jong
39cf3a6df5 docs/install: explain what to do if btcd.conf not found 2017-02-28 19:32:28 -06:00
Olaoluwa Osuntokun
e96e83f5eb
docs/grpc: add additional links to node.js tutorial 2017-02-28 18:22:06 -06:00
François
b2aa45db03 docs/grpc: add instructions for writing gRPC clients in node.js
This commit adds a basic set of instructions for installing the necessary
gRPC dependencies to be able to drive `lnd` from node.js. In the future,
this section will be expanded with additional example
scripts/applications.
2017-02-28 18:13:55 -06:00
Olaoluwa Osuntokun
564d44f64f
docs/grpc: expand python docs w/ links to official protobuf+gRPC tutorial 2017-02-28 18:09:45 -06:00
Tim Akinbo
188e4d4bec docs/grpc: added instructions for writing gRPC clients in Python
This commit adds a basic set of instructions for installing the necessary
gRPC dependencies to be able to drive `lnd` using Python. In the future,
this section will be expanded with additional example
scripts/applications.
2017-02-28 17:52:23 -06:00
Olaoluwa Osuntokun
fdaeab7c9b
brontide: refer directly to the curve object in btcec's global namespace
This commit modifies the `ecdh` function within the `brontide` package
to refer directly to the global curve params object in the `bcec`
package rather than reference it from the target public key. This
changes fixes a class of panics that have been uncovered recently but
*doesn’t* yet fix the root cause.
2017-02-28 17:44:32 -06:00
Olaoluwa Osuntokun
b4fff97d14
docs: specify protoc version and json_name usage 2017-02-27 21:04:52 -06:00
Olaoluwa Osuntokun
3a851d8bc6
lnrpc: re-compile protos with protoc v3.0.2 add json_name option
This commit modifies the protobuf file and most of the auto-generated
files to be generated by protoc version v3.0.2. Additionally, this
fixes a minor cosmetic regression within the `lncli` command line tool
which caused the JSON responses to be rendered in `camelCase` rather
than `snake_case`. We fix this by specifying the `json_name` for each
relevant RPC response.
2017-02-27 21:04:42 -06:00
Olaoluwa Osuntokun
fc54c5d8d8
lnwallet: perform sanity check on cooperative closure transacitons
This commit fixes a class of bug that currently exists within the
cooperative closure methods for the channel state machine. As an
example, due to the current hard coded fees, if one of the outputs
generated within the generated closure transaction has a negative
output, then the initiating node would gladly forward this to the
remote node. The remote node would then reject the closure as the
transaction is invalid. However, the act of completing the closure
would cause the remote node’s state machine to shift into a “closed”
state. As a result, any further closure attempts by the first node
(force or regular) would go unnoticed by the remote node.

We fix this issue by ensuring the transaction is “sane” before
initiating of completing a cooperative channel closure.

At test case has been added exercising the particular erroneous case
reported by “moli” on IRC.
2017-02-27 21:00:25 -06:00
Olaoluwa Osuntokun
8283ff2da6
lnwallet: during cooperative closure don't shift status until end
This commit avoids a class of bug wherein the state of the channel
would be marked as closing enough though an error occurred somewhere in
the function. The bug was due to the fact that the channel `status` was
shifted before any actual logic within the function(s) were executed.

We fix this bug by _only_ shifting the channel status once the function
has completed without any error.
2017-02-27 20:52:30 -06:00
Olaoluwa Osuntokun
b91dae7eaf
test: expand funding persistence test to test >1 conf channel 2017-02-24 16:32:23 -08:00
Olaoluwa Osuntokun
c55e5f708f
funding: send the next revocation key within the FundingLocked msg 2017-02-24 16:32:17 -08:00
Olaoluwa Osuntokun
c1fbcae572
funding: fix bug that marks channel as open when ChainNotifier exist early
This commit fixes a bug that resulted from properly failing to do a
2-value read from the confirmation notification channel. If the
ChainNotifier was shutting down, then a nil read could be generated
which may prematurely mark the channel as open, and also trigger a nil
pointer panic exception below when the confDetails are accessed.

We fix this issue, by ensuring that we check the second value to see if
the channel has been closed or not.
2017-02-24 16:32:14 -08:00
Olaoluwa Osuntokun
02b7b911fb
funding: add assurance select to ensure goroutines exit on quit 2017-02-24 16:32:11 -08:00
Olaoluwa Osuntokun
cef81a6adf
funding: ensure reservations are cancelled if error'd at final stage 2017-02-24 16:32:07 -08:00
Olaoluwa Osuntokun
2d703d458d
funding: fix bug, ensure we exit if too may channels are pending 2017-02-24 16:32:03 -08:00
Olaoluwa Osuntokun
b5a6098dd5
peer: don't load channels on connect that are still pending
This commit modifies the peer struct’s loadActiveChannels method to
ensure that it skips over channels that aren’t actually active. This
fixes a bug that could possibly cause a peer to get stuck in a circular
wait loop and also de-sync a channel’s state machine.
2017-02-24 16:32:00 -08:00
Olaoluwa Osuntokun
5cc0765b63
funding: rename ProcessRoutingMessage to SendToRouter
This commit renames routing processing method in the funding mangers
config from ProcessRoutingMessage to SendToRouter and also modifies the
signature to only require the message itself and not the server’s
identity public key.
2017-02-24 16:31:57 -08:00
Olaoluwa Osuntokun
c137dc53df
rpc: revert PendingChannels panic temp patch fix
With the funding manager’s state gaining full durability, it only will
return channels that are currently “pending” as a response to the
PendingChannels RPC call. As a result, the prior edge case where a user
would issue a PendingChannels RPC call mid funding flow is no longer
possible and channels are read from disk rather then from the
fundingMgr’s limbo state.
2017-02-24 16:31:54 -08:00
Olaoluwa Osuntokun
178f561a2a
rpc: don't show pending channel in the ListChannels RPC call
With the concept of open/pending channels on disk, we now will no
longer show channels under ListChannels that are still pending. This
fixes a slight existing bug wherein channels that weren’t yet open
would be listed in this RPC call since we write to disk immediately
after broadcasting the funding transaction.
2017-02-24 16:31:51 -08:00
Olaoluwa Osuntokun
f0c13c5a15
lnwallet: expose a NextRevocationKey method in channel state machine
This commit adds a new method to the channel’s state machine:
NextRevocationKey. This method is being added in preparation for the
upcoming change to switch to the commitment transaction format outlined
in the spec. When this comes to pass, the ExtendRevocationWindow method
will be removed, as it will no longer be needed.

The NextRevocationKey method will be needed as to conform to the spec,
we’ll need to send the next revocation key within the `fundingLocked`
message.
2017-02-24 16:31:48 -08:00
Olaoluwa Osuntokun
9adc5f6484
lnwallet+channeldb: update callers to shachain API changes 2017-02-24 16:31:45 -08:00
Olaoluwa Osuntokun
2e25787a74
shachain: grammer fixes, gofmt conformance, slight interface changes
This commit contains a series of post-merge fixes which include:
  * ToBytes -> Encode
    * As the former version doesn’t _require_ allocation of new slices *
  * Store -> AddNextEntry
    * To communicate to the caller that entries MUST be added
      in order
  * Several grammar, spacing, spelling and gofmt fixes.
2017-02-24 16:31:37 -08:00
bryanvu
7048480a4a minor: fixed arbiter spelling and comment/error messages in funding rpc messages 2017-02-24 11:37:33 -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
bryanvu
eb490b8833 lnwire: add FundingLocked message
When the funding transaction has been confirmed, the FundingLocked
message is sent by the peers to each other so that the existence of the
newly funded channel can be announced to the network.

This commit also removes the SingleFundingOpenProof message.
2017-02-24 11:37:33 -08:00
bryanvu
e549a3f0ed fundingmanager: move final funding steps from wallet to funding manager.
Once a channel funding process has advanced to the point of broadcasting
the funding transaction, the state of the channel should be persisted
so that the nodes can disconnect or go down without having to wait for the
funding transaction to be confirmed on the blockchain.

Previously, the finalization of the funding process was handled by a
combination of the funding manager, the peer and the wallet, but if
the remote peer is no longer online or no longer connected, this flow
will no longer work. This commit moves all funding steps following
the transaction broadcast into the funding manager, which is available
as long as the daemon is running.
2017-02-24 11:37:33 -08:00
bryanvu
508138f8c8 lnrpc: add output_index field to PendingUpdate message
Because we want to persist the state of the channel once the funding
transaction has been broadcast rather than once it has been fully
opened, we need to report the funding transaction ID to the UI or tests
when the transaction is pending, rather than after it has been
confirmed.
2017-02-24 11:37:33 -08:00
bryanvu
59763ebc7e channeldb: persist numConfsRequired in OpenChannel.
When a pending channel is persisted and then reloaded upon system startup
it's necessary to also persist the number of confirmations that will be required
before the pending channel can be opened.
2017-02-24 11:37:33 -08:00
bryanvu
0dd6cb99c1 fundingmanager: moved channel barriers from peer to funding manager.
Because peers may become disconnected or otherwise unavailable,
the channel barriers must be stored and managed within the fundingmanager.
2017-02-24 11:37:33 -08:00
bryanvu
3e02ea11ef channeldb: added isPending flag and queries
In order to facilitate persistence during the funding process, added
the isPending flag to channels so that when the daemon restarts, we can
properly re-initialize the chain notifier and update the state of
channels that were going through the funding process.
2017-02-24 11:37:33 -08:00
Andrey Samokhvalov
9034f85b88 features: add shachain required feature flag 2017-02-22 16:49:29 -08:00
Andrey Samokhvalov
f86557c3e4 channeldb+lnwallet: replace elkrem with shachain
In this commit the initial implementation of revocation hash
generation 'elkrem' was replaced with 'shachain' Rusty Russel
implementation which currently enshrined in the spec. This alghoritm has
the same asymptotic characteristics but has more complex scheme
to determine wish hash we can drop and what needs to be stored
in order to be able to achive full compression.
2017-02-22 16:49:29 -08:00
Andrey Samokhvalov
b40afeaa08 shachain: complete shachain implementation 2017-02-22 16:49:29 -08:00
Olaoluwa Osuntokun
3a647869b6
lnwire: fix features_test.go to not reference removed .String() method 2017-02-22 16:01:42 -08:00
Olaoluwa Osuntokun
3e14c6ee9b
features+lnd: add a feature bit for 48-bit state hints 2017-02-22 15:54:31 -08:00