Commit Graph

633 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
77df8e3a43
Merge pull request #4130 from cfromknecht/open-channel-refactor
rpcserver: align OpenChannel + OpenChannelSync request parsing
2020-03-31 18:05:00 -07:00
Conner Fromknecht
66d02504f9
rpcserver: align OpenChannel+OpenChannelSync req parsing
This commit consolidates our request parsing for OpenChannel and
OpenChannelSync which removes a good deal of code duplication.
2020-03-31 11:24:13 -07:00
Joost Jager
baffe156db
lnrpc: expose commitment type on pending open and waiting close channels 2020-03-31 19:35:52 +02:00
Joost Jager
41573004a3
lnrpc: extract rpcCommitmentType 2020-03-31 19:35:50 +02:00
Conner Fromknecht
c1f9c56e5b
rpcserver: add self-node check in OpenChannelSync 2020-03-31 10:21:29 -07:00
Conner Fromknecht
303d441d4d
rpcserver: ensure OpenChannel+OpenChannelSync parse NodePubkey 2020-03-31 10:21:29 -07:00
Conner Fromknecht
1823840ed6
rpcserver: add missing channel limit check to OpenChannelSync 2020-03-31 10:21:29 -07:00
Conner Fromknecht
5660a26b60
rpcserver: add wallet sync check to OpenChannel 2020-03-31 10:21:24 -07:00
Oliver Gugger
376a747bb2
rpcserver: implement PSBT funding flow
A PSBT funding flow consists of multiple steps. We add new RPC
messages that can trigger the underlying state machine to transition
to a new state. We also add new response messages that tell the
API user what the current state is.
2020-03-31 09:17:24 +02:00
Andras Banki-Horvath
93cb05142a lnrpc: rename FloatValue to FloatMetric
This commit renames lnrpc.FloatValue to lnrpc.FloatMetric as requested
in the final review of centrality PR.
2020-03-30 16:36:11 +02:00
Olaoluwa Osuntokun
eb10594381
Merge pull request #4092 from Crypt-iQ/peer_ll_0210
link+peer: buffer messages until link active
2020-03-27 13:20:25 -07:00
Andras Banki-Horvath
608354032c autopilot: parallelize betweenness centrality
This commit parallelizes betweenness centrality calculation, by
distributing the algo to N workers and creating partial results.
2020-03-27 13:56:10 +01:00
Andras Banki-Horvath
7e50997bb4 lnrpc: add betweenness centrality to GetNodeMetrics (new RPC call)
This commit extends the RPC interface with GetNodeMetrics will contain
all graph node metrics in the future. Currently only holds betweennes
centrality per node.
2020-03-27 13:56:08 +01:00
nsa
966cd2112c multi: link notifies subscribers of ActiveLinkEvent, rpc ignores 2020-03-27 08:49:46 -04:00
carla
9e1cdb78e7
lnrpc: deprecate unused pending closing channels field
The pending closing channels field was present to cover an edge case
where coperatively closed channels were closed before upgrade and
confirmed after the upgrade. This commit deprecates the field and adds
a warning log to cover these edge cases.
2020-03-25 08:48:19 +02:00
carla
8b83c1f7f9
lnrpc: add commit fees to WaitingPendingClose 2020-03-25 08:45:08 +02:00
carla
fd6b397496
lnrpc: add initiator bool to PendingChannel message 2020-03-25 08:42:26 +02:00
Olaoluwa Osuntokun
1ac7550e3f
chancloser: deny co-op close initiated by the chan initiator for frozen chans 2020-03-23 16:57:03 -07:00
Olaoluwa Osuntokun
8bce48d3cc
lnwallet/chanfunding: add new ThawHeight() method to ShimIntent+CannedAssembler
As frozen channels can only be created via the non-default channel
assembler, we extend both the ShimIntent and CannedAssembler to also
accept and expose this new channel status along with the thaw height.
2020-03-23 16:56:57 -07:00
carla
72e3b0a5d7
lnrpc: add push amount to listchannels 2020-03-19 13:20:26 +02:00
Olaoluwa Osuntokun
071c7cbe78
lnd: convert to use new kvdb abstraction 2020-03-18 19:35:23 -07:00
Joost Jager
e2052f7f65
Merge pull request #3758 from joostjager/anchor-output-poc-joost
cnct: anchor output sweeping and fee bumping
2020-03-18 18:59:06 +01:00
Joost Jager
d60303b092
lnrpc: expose commit hashes for waiting close channels
To make it easier to determine which pending sweep to bump in order to
get your anchor commitment tx confirmed.
2020-03-18 12:27:05 +01:00
Joost Jager
ab451f634e
cnct+lnrpc: report anchor resolution 2020-03-18 12:27:03 +01:00
Joost Jager
d84b596f55
cnct: do not ignore resolver reports after resolution
Preparation for anchor resolver. The recovered anchor amount should
still be included in the pending channel report even after it has been
resolved.

This also fixes an existing bug that in some cases caused the recovered
amount from an htlc resolver not to be included in the total.
2020-03-18 12:26:59 +01:00
Conner Fromknecht
b6a0bfcabe
Merge pull request #3848 from carlaKC/htlcnotifier-3-addhtlcnotifierrpc
[htlcnotifier 4/4]: lnrpc: Add HTLC Event Subscription
2020-03-17 16:37:52 -07:00
carla
4c48d0361d
lnrpc+lncli: display peer errors in listpeers
This change adds a set of errors to the peer struct returned by list
peers. A latest error boolean is added to allow for more succinct
default lncli responses.
2020-03-17 08:22:50 +02:00
Johan T. Halseth
7d305fdc46
lnrpc: add commitment_type to listchannels 2020-03-13 20:00:48 +01:00
carla
67d4bad73f
rpcserver+routerrpc: add subscribe events to router backend
Add SubscribeHtlcEvents to RouterBackend in preparation for the
addition of a HtlcNotifier stream.
2020-03-13 09:30:16 +02:00
Olaoluwa Osuntokun
cbef26b9f6
Merge pull request #3993 from guggero/unconfirmed-chanbackup
chanbackup: update on-disk backup file with unconfirmed channels
2020-03-09 17:18:23 -07:00
Oliver Gugger
9aff896b10
lnrpc+rpcserver+lncli: rename RPC fields to previous JSON name 2020-03-07 11:24:13 +01:00
Conner Fromknecht
11532df5f3
cmd/lncli: add --peer flag to list channels
This commit adds a flag to listchannels that filters by remote pubkey.
2020-03-05 20:44:18 -08:00
Conner Fromknecht
5c9b336a61
lnrpc+rpcserver: expose short chan id on feereport
This commit adds each channel's short chan id to the `feereport` rpc.
Without this, it can be tedious to lookup more info about a particular
channel since most rpcs only accept short chan ids and not channel
points. For instance, now one can take a channel id from `feereport` and
look it up directly via `getchaninfo` to examine the policy in more
detail.
2020-03-04 15:37:17 -08:00
Oliver Gugger
ab024b98ee
rpcserver+itest: remove channel from backup when abandoning it 2020-03-04 10:58:50 +01:00
Oliver Gugger
4e0c276154
rpcserver: don't skip pending channels in backup subscription
The synchronous call to get all channel backups also include
channels that are pending at the moment of the call. A previous
commit added pending channels to the file based backup as well. So
this is the last backup method that needs to be adjusted to also
contain unconfirmed channels.
2020-03-04 10:58:49 +01:00
carla
e74b6f88b7
rpcserver: display open and close initiator 2020-02-21 13:53:51 +02:00
Johan T. Halseth
f16fe7b483
Merge pull request #3916 from chokoboko/rpcserver-remove-duplicated-permission-entity
[trivial] rpcserver: remove duplicated 'address' permission entity
2020-02-11 08:15:34 +01:00
Oliver Gugger
c8b7108eeb
rpcserver: instruct REST marshaler to emit default values
This change instructs the REST proxy server to overwrite its default
JSON marshaler settings. That allows us to set EmitDefaults to true
which will result in all JSON fields returned in REST responses to
be fully populated, even if their values are falsey.
2020-01-27 15:40:39 +01:00
Hampus Sjöberg
227e66c469 rpc: Add PendingOpenChannel to SubscribeChannelEvents
This commit adds PendingOpenChannel to SubscribeChannelEvents stream in
the gRPC API.
This is useful for keeping track of channel openings that Autopilot does.
It can also be used for the non-initator side of a channel opening to keep
track of channel openings.
2020-01-24 13:48:18 +01:00
Johan T. Halseth
dc23810118
rpcServer: wait for all goroutines to finish before exiting
Returning from the sendPayments method closes the underlying stream, so
we would risk payments still being in flight when returning.

We add the running goroutines to a waitgroup, such that we can wait for
them all to exit before exiting and closing the stream.

In case an error is encountered in the process, we will return directly,
which will close the `reqQuit` channel and prompt the gorpoutines to
shut down.
2020-01-21 12:45:12 +01:00
Johan T. Halseth
5b85721c04
rpcServer: ensure all payIntents are handled before exiting
This commit fixes a problem that could arise when handling a continuous
stream of payIntents. We would risk the client sending a set of payment
intents and closing the stream, but we wouldn't be sure the sendLoop had
read all messages on the `payChan` before exiting with the nil error
from the `errChan`.

Instead, we close the `payChan` to indicate that no more payments are
going to be received.
2020-01-21 12:45:12 +01:00
Johan T. Halseth
c49ba0c5cb
rpcServer: ensure we don't get blocked on bidirectional payment errors
This commit fixes a potential issue in the bidirectional sendPayment
case, where multiple goroutines could be sending on an errChan with
buffer 1. Instead we select on default as well, as it is enough to
handle the first error that was received.
2020-01-21 12:45:12 +01:00
Johan T. Halseth
f20f29696a
rpcserver: let sendPayment sendLoop listen for shutdown
Intead of checking for shutdown in the receive loop, we let the sendLoop
handle it, as it can return the error directly. This works since the
returning sendLoop will trigger a close of the `reqQuit` channel, which
will ensure the receive loop exits.
2020-01-21 12:28:31 +01:00
chokoboko
0b9940a398 Remove duplicated address permission entity 2020-01-15 14:03:44 +02:00
Joost Jager
5de308c4b5
routerrpc: update final cltv delta default
The default was increased for the main sendpayment RPC in commit
d3fa9767a9729756bab9b4a1121344b265410b1a. This commit sets the
same default for QueryRoutes, routerrpc.SendPayment and
router.EstimateRouteFee.
2020-01-14 21:03:24 +01:00
Joost Jager
d3fa9767a9
rpc: use more sensible final cltv delta default when sending payments 2020-01-10 21:35:34 +01:00
Olaoluwa Osuntokun
bc176b5aa3
rpc+lnwallet: implement new FundingStateStep RPC method
In this commit, we implement the currently defined transition methods
for the new `FundingStateStep` method. At this point, we're now able to
serve the "responder" of the externally initiated channel funding flow
by being able to register and cancel a funding flow according to its
expected pending channel ID.
2019-12-20 19:09:44 -08:00
Olaoluwa Osuntokun
91bd56dbd1
funding+rpc: expand specified chan point shim into a canned assembler
In this commit, we update the `OpenChannel` method to observe the new
`funding_shim` field in the main open channel request. If this is
specified, and is a channel point shim, then we'll create a custom
`chanfunding.Assembler` for the wallet to use in place of the regular
funding workflow.

With this commit, the "initiator" of an external funding flow can now
delegate the remainder of the channel funding workflow to lnd.
2019-12-20 19:09:41 -08:00
Olaoluwa Osuntokun
3eed38d602
lnrpc: add ability to provide chan point shims for funding, new funding modifiers
In this commit, we start to expose some of the new external funding
functionality over the RPC interface.

First, we add a new `funding_shim` field to the regular `OpenChannel`
method. This can be used by a caller to express that certain parameters
of the funding flow have already been negotiated outside the protocol,
and should be used instead. For example, a shim can be provided to use a
particular key for the commitment key (ideally cold) rather than use one
this is generated by the wallet as normal, or signal that signing will
be carried out in an interactive manner (PSBT based).

Next, we add a brand new method: `FundingStateStep`. FundingStateStep is
an advanced funding related call that allows the caller to either
execute some preparatory steps for a funding workflow, or manually
progress a funding workflow. The primary way a funding flow is
identified is via its pending channel ID. As an example, this method can
be used to specify that we're expecting a funding flow for a particular
pending channel ID, for which we need to use specific parameters.
Alternatively, this can be used to interactively drive PSBT signing for
funding for partially complete funding transactions.

The new transition methods (funding state machine modifiers) in this
commit allow a party to register a funding intent that should be used
for a specified incoming pending channel ID. The "responder" to the
external channel flow should use this to prep lnd to be able to handle
the channel flow properly.
2019-12-20 19:09:38 -08:00
Joost Jager
95ddab57fa
channeldb: add tx argument for FetchLightningNode
To allow execution within an existing tx.
2019-12-20 10:17:01 +01:00