Commit Graph

225 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
3df5b090da
rpc: enforce the max payment size as defined in BOLT-0002
This commit modifies the relevant RPC’s to enforce the max payment size
as defined in BOLT-0002. With this commit the largest payment possible
is now 2^32 mSAT, or 4,294,967 satoshis.
2017-08-22 00:53:57 -07:00
Olaoluwa Osuntokun
1a90991905
rpc: ensure the inner grouting within SendPayment will always exit
This commit adds a new reqQuit channel within SendPayment. The inner
goroutine will use this channel to detect if the request itself has
exited or not. Without this method, we’d possible leak a goroutine if a
client never closed the payment stream.
2017-08-22 00:53:54 -07:00
Olaoluwa Osuntokun
6ad803b99c
rpc: make NewWitnessAddress return np2wkh addresses
This commit modifies NewWitnessAddress to return nested p2wkh address.
We do this as this RPC call was put in place to be used within GUI’s to
allow users to deposit funds into their LN wallet. By using nested
p2wkh, we ensure that the generate address that can be used to directly
create channels.
2017-08-22 00:53:51 -07:00
Olaoluwa Osuntokun
d49172aa50
rpc: add feereport to set of read only macaroon caveats 2017-08-22 00:53:48 -07:00
Olaoluwa Osuntokun
44cafb01ae
rpc: add implementations for UpdateFees and FeeReport 2017-08-22 00:53:46 -07:00
Olaoluwa Osuntokun
01b0ddf1c5
lnd+rpc: update RPC responses to convert mSAT to SAT 2017-08-22 00:52:56 -07:00
Alex
922b065de5 main: integrate macaroons into config, startup, and RPC server 2017-08-17 19:20:41 -07:00
Max Fang
b88438d708 lnrpc: Add descriptions and lncli mappings to rpc.proto 2017-08-14 17:53:19 -07:00
Olaoluwa Osuntokun
512a5c899b
rpc: only set balance params when force closing if output not dust
This commit fixes an existing bug that would cause a force closed
channel to stay pending forever. In this instance, if one force closes
a channel while they have a dust output, and restart before the channel
is fully closed, then it wouldn’t have been closed automatically
(within the database) by the autopilot agent.
2017-08-10 21:43:17 -07:00
Conner Fromknecht
13b78fea1f rpcserver: lookup num pending channels from chanDB 2017-08-10 16:14:01 -07:00
Conner Fromknecht
d3dc546108 lnd+rpcserver: use new public server API 2017-08-10 16:14:01 -07:00
Johan T. Halseth
80a8cc0add rpcserver: fix method name typo in godoc 2017-08-10 13:14:25 -07:00
Olaoluwa Osuntokun
203d038b71
funding: enforce the 2^24 satoshi funding limit in BOLT-0002 2017-08-07 16:31:25 -07:00
Olaoluwa Osuntokun
6307f7243e
rpc: ensure db is updated on force close if no outputs to sweep
This commit fixes an issue where if a party force closing a channel,
doesn’t have a non-dust balance, nor any outgoing HTLC’s, then the
channel would never be marked as fully closed within the database.

We ensure that this case is addressed, by inserting a checking to
determine if we have any funds to sweep, marking the channel fully
closed on initial commitment transaction confirmation if not.
2017-08-04 18:29:22 -07:00
Olaoluwa Osuntokun
d39410cc01
rpc: wrap canceling a breach watch in a select case 2017-08-03 16:40:15 -07:00
Olaoluwa Osuntokun
a709164aef
rpc: populate the expiry field within marshalRoute 2017-08-02 21:18:21 -07:00
Olaoluwa Osuntokun
006dff1207
rpc: ensure that calls that depend server are rejected if server not active
This commit adds a bit of a guard to a set of RPC calls. If an RPC call
needs to interact with the server but it hasn’t yet been started. Then
we’ll exit early in order to avoid blocking the call until the server
itself has started.

A recent change to the initialization order of sub-systems within lnd
results in a state where the daemon will wait for the wallet itself to
finish syncing _before_ the server is started. This was interpreted as
a bug by some users, so we’ll make the state of the server more
explicit by returning an error.
2017-08-02 20:59:51 -07:00
Olaoluwa Osuntokun
5425eff09c
multi: ensure all lnwallet.LightningChannel's are stopped
This commit ensures that we always clean up the resources that are
created when a new instance of a lnwallet.LightningChannel is
instantiated. The is necessary due to the sigPool that’s now present as
an internal goroutine.
2017-07-31 21:07:02 -07:00
Olaoluwa Osuntokun
5ed9375e94
rpcserver: update RPC function impls to account for new API changes 2017-07-30 17:51:51 -07:00
Olaoluwa Osuntokun
7c5af4b851
rpc: properly return satoshis in WalletBalance response 2017-07-04 15:51:08 -07:00
Olaoluwa Osuntokun
e15604f7b5
peer: ensure latest version of htlcswitch.Peer interface is implemented 2017-06-17 00:11:10 +02:00
Olaoluwa Osuntokun
aec8c8dc77
lnd: decouple rpcServer from server, wait till chain synced before starting server
This commit overhauls the way that lnd is created with the goal of
ensuring the chain backends are fully synced up before the daemon
itself starts. The rpcServer has been slightly decoupled from the
server itself s.t we can start the rpcServer independently of the
server. This is required as we’ll now wait (unless we’re in simnet
mode) for the chain to fully sync up before we even _start_ any of the
server’s goroutines.
2017-06-05 19:22:12 -07:00
Olaoluwa Osuntokun
25dc294cf0
server: all references to primary interfaces are now through chainControl 2017-06-05 18:53:37 -07:00
Olaoluwa Osuntokun
1aaf37974a
rpc: fix bug in GetNetworkInfo that causes NaN outputs in JSON
Previously the integers would either underflow or the floating point
division would result in odd numbers if a node knew of zero channels
within the network graph. We now fix this situation by checking to see
if any channels exist before computing the network stats.

Fixes #211.
2017-05-31 11:30:42 -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
Andrey Samokhvalov
c4955258f1 htlcswicth: start use htlcswitch and channel link inside lnd
In current commit big shift have been made in direction of unit testable
payments scenarios. Previosly two additional structures have been added
which had been spreaded in the lnd package before, and now we apply
them in the lnd itself:

1. ChannelLink - is an interface which represents the subsystem for
managing the incoming htlc requests, applying the changes to the
channel, and also propagating/forwarding it to htlc switch.

2. Switch - is a central messaging bus for all incoming/outgoing htlc's.
The goal of the switch is forward the incoming/outgoing htlc messages
from one channel to another, and also propagate the settle/fail htlc
messages back to original requester.

With this abtractions the folowing schema becomes nearly complete:

abstraction
    ^
    |
    | - - - - - - - - - - - - Lightning - - - - - - - - - - - - -
    |
    | (Switch)		        (Switch)		  (Switch)
    |  Alice <-- channel link --> Bob <-- channel link --> Carol
    |
    | - - - - - - - - - - - - - TCP - - - - - - - - - - - - - - -
    |
    |  (Peer) 		        (Peer)	                  (Peer)
    |  Alice <----- tcp conn --> Bob <---- tcp conn -----> Carol
2017-05-31 11:06:08 -07:00
Olaoluwa Osuntokun
2b5d46f135
rpc: display commitment weight+fee info in pendingchannels/listchannels 2017-05-16 19:14:56 -07:00
Olaoluwa Osuntokun
75858a604a
lnd: use a single instance of a FeeEstimator daemon-wide 2017-05-16 19:11:49 -07:00
bryanvu
abe2e502d5 lnwallet: add FeeEstimator interface, StaticFeeEstimator implementation
This commit adds the FeeEstimator interface, which can be used for
future fee calculation implementations. Currently, there is only the
StaticFeeEstimator implementation, which returns the same fee rate for
any transaction.
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
Olaoluwa Osuntokun
9c685433f3
rpc: non-existence of a nursery report is no longer an error
This commit fixes a slight logic error that could render the
`pendingchannels` RPC unusable if a node was on the reciting end of a
channel force close with no time-locked balance. In such a case the
channel wouldn’t be sent to the utxoNursery, resulting in an “contract
not found error”.

To fix this behavior, we’ve created a typed error that can be checked
within the RPC, thus we no longer treat this routine case as an error
case.
2017-05-14 19:20:31 -07:00
Olaoluwa Osuntokun
57f576bbf1
rpc: include pending close channels in total limbo balance 2017-05-14 18:51:35 -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
d47f004fbd
peer+rpcserver+breacharbiter: usel latest ChainNotifier API 2017-05-11 15:20:55 -07:00
halseth
aa4e166539 lnrpc+rpc+lnd: add new Stop command for gracefully shutting down lnd
This commit adds simple non-blocking stop command to lncli, with an
appropriate proto update and implementation within the rpcserver.  When
invoked the interrupt handler routine in signal.go with begin the graceful
shutdown of lnd.
2017-05-11 14:55:56 -07:00
Olaoluwa Osuntokun
6429962d27
rpc: modify DisconnectPeer implementation to do all validation within rpcServer
This commit modifies the implementation of the new DisconnectPeer RPC
in the following ways:
   * all validation has moved from the server to the rpcserver
   * rather than iterating over _all_ channels, we now only check the
     peer’s channels
   * the disconnectPeerMsg now has a public key object
      * this allows us to also verify that the user submitted a valid
        pub key string
   * we now check if a peer was persistent when disconnecting so we can
     remove them from the persistent peer map
2017-05-05 16:02:20 -07:00
afederigo
cf605c81ab lnd: add server calls for disconnecting peers
Issue: 139

This commit contains client-side and server-side functionality
for disconnecting peers. rpc-client calls server side method and sends
message with pubKey.
2017-05-05 14:24:25 -07:00
Olaoluwa Osuntokun
ad2dc46ffe
rpc: implement new version of the PendingChannels PRC 2017-05-04 17:40:31 -07:00
Olaoluwa Osuntokun
3fd161d527
rpc: when force closing, properly manage on-disk channel close state 2017-05-04 17:39:51 -07:00
Olaoluwa Osuntokun
7e8c840f29
rpc: when force closing ensure switch+peer indexes are wiped 2017-05-04 17:39:45 -07:00
Olaoluwa Osuntokun
54177557be
rpc: don't count pending channels in total channel balance 2017-05-04 17:39:10 -07:00
Olaoluwa Osuntokun
6cd9f48387
rpc: list the active chains in GetInfoResponse
This commit modifies the server’s implementation of the GetInfo command
to list the chains that lnd is currently active within.
2017-05-02 19:58:07 -07:00
Olaoluwa Osuntokun
7fe02c7bf6
rpc: list the payment hash in invoice related responses
Previously only the pre-image was listed, but for the convenience of
the consumers of this RPC service, we now also return the payment hash
itself.
2017-04-23 19:20:27 -07:00
Olaoluwa Osuntokun
d188d97fce
rpc: disallow connections to self, channel open attempt to self
Fixes #193.
2017-04-21 13:32:22 -07:00
Olaoluwa Osuntokun
f867252139
peer: switch to new WriteMessage/ReadMessage after wire msg changes 2017-04-19 16:23:22 -07:00
Olaoluwa Osuntokun
7ac50b060e
rpc: re-write GetNetworkInfo implementation to use single db transaction
This commit re-writes the GetNetworkInfo implenetaiton to use a single
database transaction. We’re now able to do this due to the recent
change in the API for the ChannelGraph struct and it’s related objects.
The recent change allows the passed callback to accept a db
transaction, with this, the callback is now able to issue another
traversal routine _within_ the prior one.
2017-04-14 13:18:02 -07:00
Olaoluwa Osuntokun
9ff4a7adc9
rpcserver: use semaphore to limit # of goroutines in SendPayment
This commit fixes a prior oversight in the implementation of
SendPayment that could result in tens of thousands of goroutines
OOM’ing an lnd daemon. Previously we didn’t limit the number of
outstanding payments that were allowed by a client. Users on machines
with a small amount of RAM were reporting crashes when sending a very
large number of payments in a consistent stream. This commit fixes this
issue by now using a semaphore to limit the number of outstanding
payments (and therefore) goroutines allowed in the SendPayment method.
2017-04-11 22:02:20 -07:00
Olaoluwa Osuntokun
d2b4f143b9
rpc: allow for omitting the port when handling the Connect RPC
This commit slightly modifies the handling of the Connect RPC to allow
users to omit the port when specifying the target node to connect to.
If the port isn’t specified, then the default p2p port will be used in
place.
2017-03-29 21:19:34 -07:00
bryanvu
9ffac9eae1 lnwire: update NodeAnnouncement to handle multiple addresses
This commit modifies address handling in the NodeAnnouncement struct,
switching from net.TCPAddr to []net.Addr. This enables more flexible
address handling with multiple types and multiple addresses for each
node. This commit addresses the first part of issue #131 .
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
Thomas Preindl
862722d6fe lnrpc: switch Transaction.Amount from double (BTC) to int64 (sat) 2017-03-16 12:39:40 -07:00
Thomas Preindl
b880d2dd03 rcpserver: add missing BlockHeight value to GetTransactions response 2017-03-16 12:39:40 -07:00
Olaoluwa Osuntokun
f217093c00
multi: replace usage of fastsha256 with crypto/sha256
This commit removes all instances of the fastsha256 library and
replaces it with the sha256 library in the standard library. This
change should see a number of performance improvements as the standard
library has highly optimized assembly instructions with use vectorized
instructions as the platform supports.
2017-03-15 18:56:41 -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
24a69c1164
rpc: implement new streaming SubscribeChannelGraph RPC call
This commit implements the new server-side streaming RPC call within
the current default implementation of the RPC server. With this, the
new functionality can now be used within the integration tests to
achieve a greater degree of synchronization in the tests. As a result,
we should be able to eliminate many of the sleeps lingering within the
tests.
2017-03-14 20:07:43 -07:00
Andrey Samokhvalov
143a6e01bb lnd: fix unconvert warnings 2017-03-13 16:30:23 -07:00
Olaoluwa Osuntokun
1dfda91415
lnrpc: add field denoting if channel peer is online in ListChannels
This commit adds a new field to the ListChannels RPC command which
indicates if the peer is currently online or not. This is useful as
UI’s will be able to use this information to communicate the
availability of each channel to an end user.
2017-03-08 14:46:24 -08: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
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
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
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
bryanvu
b21bd351e8 fundingmanager: change funding messages to use server.sendToPeer
Previously, during the channel funding process, peers sent wire
messages using peer.queueMsg. By switching to server.sendToPeer, the
fundingManager is more resilient to network connection issues or system
restarts during the funding process. With server.sendToPeer, if a peer
gets disconnected, the daemon can attempt to reconnect and continue the
process using the peer’s public key ID.
2017-02-21 19:21:19 -08:00
Andrey Samokhvalov
69faebfcae rpcserver: fix pendingchannels panic 2017-02-21 16:39:16 -08:00
Olaoluwa Osuntokun
2dfab8c6d7
routing+lnd: provide payment premiere as response to SendPayment 2017-02-21 01:43:48 -08:00
Olaoluwa Osuntokun
857c11c273
rpc: properly detect case where remote party closes unknownst to us
This commit addresses an edge case which has been discovered by testers
of lnd of testnet. When/if channels get out of sync the unilateral
channel closure of a remote node may go undetected, which causes the
local node to lose their ability to purge the now closed channel from
their database state.

With this commit, if we try to force close a channel but detect it as
double-spent due to a prior commitment transaction being broadcast,
then we simply forget the channel as it has already been closed.
2017-02-21 01:43:24 -08:00
Olaoluwa Osuntokun
7669ac3918
rpc: populate the payment route taken in resp to SendPaymentSync 2017-02-21 01:42:58 -08:00
Olaoluwa Osuntokun
5560f032f6
rpc+routing: fix panic when channel edge but no edge info in db 2017-02-16 19:35:32 +08:00
Olaoluwa Osuntokun
384fe61e73
multi: fix go vet warnings throughout code base 2017-02-16 19:33:19 +08:00
Olaoluwa Osuntokun
71bb430836
rpc: don't return an error if no payments exist for ListPayments 2017-02-04 16:54:27 -08:00
Olaoluwa Osuntokun
f4b403679b
lnwallet: remove BlockChainIO as a dependency to LightningChannel
This commit removes the BlockChainIO interface as a dependency to the
LightningChannel struct as the interface is no longer used within the
operation of the LightningChannel.
2017-02-02 17:05:40 -08:00
Olaoluwa Osuntokun
3f6afa51b9
rpcserver: fix potential panic when opening channel to peer_id
This commit fixes a potential panic that could arise when one was
attempting to open a channel with the target peer identified by it’s
peerID and an error occurred. In this case, the nodepubKey pointer
would be nil, resulting in a panic when attempting to propagate the
error.

This commit fixes this bug by using a nil byte slice for the node’s
serialized pubkey in the case that the node was identified according to
ti’s peer ID.
2017-02-02 16:50:29 -08:00
Olaoluwa Osuntokun
08f0d0fbea
routing+rpcserver: move route querying+sending to SendPayment
This commit moves much of the logic for querying for a potential route,
constructing the HTLC including the Sphinx packet, and sending the
ultimate payment from the rpcServer to the ChannelRouter.

This movement paves the way for muilt-path path finding as well as
adding automatic retry logic to the ChannelRouter. Additionally, by
having the ChannelRouter construct the Sphinx packet, we’ll be able to
also include the proper time-lock and general per-hop-payload
information properly in the future.
2017-02-01 18:29:55 -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
780203e287
rpcserver: display the number of satoshis sent/recv'd and ping time in ListPeers 2017-01-25 18:25:12 -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
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
e7631c9720
rpcserver: ensure graph RPC's work with partially advertised channels 2017-01-17 13:20:18 -08:00
Olaoluwa Osuntokun
440cf6f956
rpcserver: properly limit min channel size 2017-01-17 13:18:34 -08:00
Olaoluwa Osuntokun
fb523ff5ac
rpcserver: add a min channel size for funding requests
This commit adds a soft-limit for the minimum allowed channel size.
Without this limit a user may inadvertently create an invalid or
unspendable output due to the hard coded fees in a few areas of the
codebase.

This is a temporary measure, and will be removed once we add dynamic
fees into the mix.
2017-01-16 20:48:17 -08:00
Olaoluwa Osuntokun
7d6d8187fb
rpcserver: return full path payments go over in SendPayment
This commit augments the server’s response to successful SendPayment
commands by also returning the full path taken in order to fulfill the
payment. With this information, the user now obtains more context about
their payment whcih can be useful when debugging, or just exploring the
capabilities of the daemon.
2017-01-16 20:41:38 -08:00
Olaoluwa Osuntokun
012480be98
rpcsever: implement DebugLevel command 2017-01-14 18:16:59 -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
0bfdcde969
rpcserver: include encoded payment requesting ListInvoices response 2017-01-12 18:52:40 -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
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
219c79e726
rpcserver: don't error out in ListChannels if unable to retrieve chanID 2017-01-07 21:21:55 -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
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
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
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
1210640e87
rpcserver: implement new set of network/routing RPC's 2016-12-27 16:44:53 -08:00
Olaoluwa Osuntokun
ea6f6d6069
rpcserver: modify SendPayment to use new routing pkg API 2016-12-27 16:44:50 -08:00
Olaoluwa Osuntokun
abfef02df2
rpcserver: include channelID in ListChannels response 2016-12-27 16:44:48 -08:00