Commit Graph

788 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
9042a79db2
Merge pull request #4683 from carlaKC/4471-acceptorupfrontshutdown
channelacceptor: add new fields to acceptor response
2020-11-11 17:43:52 -08:00
Johan T. Halseth
a2a924e1e5
rpcserver: move TLS listen config to closure 2020-11-11 09:37:52 +01:00
carla
5679dde1bc
multi: add channel open parameters to channel acceptor
Add more fields to channel acceptor response so that users can have more
fine grained control over their incoming channels. With our chained
acceptor, it is possible that we get inconsistent responses from
multiple chained acceptors. We create a conjugate repsponse from all the
set fields in our various responses, but fail if we get different, non-
zero responses from our various acceptors. Separate merge functions are
used per type so that we avoid unexpected outcomes comparing interfaces
(panic on comparing types that aren't comparable), with casting used
where applicable to avoid code duplication.
2020-11-10 21:09:10 +02:00
carla
0d35ce7561
mutli: move parse upfront shutdown out of rpcserver 2020-11-10 11:40:52 +02:00
carla
54c3e98b40
multi: move channel acceptor logic out of rpcserver
This commit moves and partially refactors the channel acceptor logic
added in c2a6c86e into the channel acceptor package. This allows us to
use the same logic in our unit tests as the rpcserver, rather than
needing to replicate it in unit tests.

Two changes are made to the existing implementation:
- Rather than having the Accept function run a closure, the closure
  originally used in the rpcserver is moved directly into Accept
- The done channel used to signal client exit is moved into the acceptor
  because the rpc server does not need knowledge of this detail (in
  addition to other fields required for mocking the actual rpc).

Crediting orginal committer as co-author:
Co-authored-by: Crypt-iQ
2020-11-10 11:38:45 +02:00
Roei Erez
4463a4ce17 invoicerpc: Allow user specify routing hints. 2020-11-06 17:54:20 +02:00
Andras Banki-Horvath
e8f47cf882
invoices: channel graph reference was wrongly retrieved from remote db
This commit fixes a bug where we tried to use the graph from the remote
db instance whereas it lives in the local db instance.
2020-11-05 17:57:13 +01:00
carla
91bf59df17
multi: allow specifying max csv for locally initiated channels 2020-11-04 13:55:39 +02:00
Eugene
225390ab5b
Merge pull request #4487 from Crypt-iQ/cc_pkg_0723
chainreg: new chainreg package
2020-10-30 06:07:26 -04:00
Eugene
46ef212de4 lnd+lncfg: move normalizeNetwork to lncfg 2020-10-29 15:20:00 -04:00
Eugene
4d238cfa2f lnd: export ChainControl, ChainRegistry 2020-10-29 15:20:00 -04:00
Eugene
f4fe76aaf1 chainreg: add Config, move chainparams.go
Creates a Config that initializes the chainregistry struct in the
lnd package. Also moves all of chainparams.go to the chainreg
package.
2020-10-29 15:19:58 -04:00
Eugene
933b959aa8 chainreg: export ChainCode to new pkg
Moves chainCode from the lnd package to the chainreg package,
where it is exported and can be used by other packages.
2020-10-29 15:19:57 -04:00
Joost Jager
49df2d6f8b
lnrpc: expose forwarding channel for htlcs in ListChannels 2020-10-16 09:03:24 +02:00
Joost Jager
d13b813dbb
lnrpc: add htlc index to ListChannels pending htlcs 2020-10-14 17:44:22 +02:00
Tom Kirkpatrick
73a5f325b6
lnrpc: ability to spend unconfirmed coins 2020-10-01 13:27:03 +01:00
yyforyongyu
f8c1bee637
lnrpc+rpcserver: verbose result in ChannelBalance 2020-09-24 20:26:08 +08:00
yyforyongyu
245db6a7fe
rpcserver: fix make lint 2020-09-16 12:08:46 +08:00
yyforyongyu
469aba9282
lnd+rpcserver: allow customized timeout in ConnectPeer 2020-09-16 11:50:04 +08:00
Oliver Gugger
5375f88b55
lnwallet+rpcserver: allow final raw tx to be specified
With this commit we allow the final transaction of a PSBT funding flow
to also be specified as a raw wire format transaction.
2020-09-15 08:30:23 +02:00
Carla Kirk-Cohen
db0802bc8d
Merge pull request #4440 from carlaKC/4165-ratelimit
chanfitness: Rate limit in memory events based on peer flap rate
2020-09-14 13:11:07 +02:00
Oliver Gugger
061040c57b
rpcserver: export MainRPCServerPermissions
To be able to properly delegate requests to the correct component in LiT we
need to know all URIs of lnd and the other subservers.
2020-09-10 10:25:38 +02:00
Oliver Gugger
8988a01d7e
lnd+rpcserver: allow external subservers to specify macaroon validator
Give the external subservers the possibility to also use their own
validator to check any macaroons attached to calls to their registered
gRPC URIs.
This allows them to have their own root key ID database and permission
entities.
2020-09-10 10:24:10 +02:00
carla
e2c0604657
multi: add flap count and last flap time to listpeers 2020-09-08 15:01:06 +02:00
carla
e05b4a8e2e
chanfitness: refactor to store channels by peer
When dealing with online events, we actually need to track our events
by peer, not by channel. All we need to track channels is to have a
set of online events for a peer which at least contain those events.
This change refactors chanfitness to track by peer.
2020-09-08 13:47:18 +02:00
carla
10f9ba952e
chanfitness: unify requests to store in single chan info struct
We currently query the store for uptime and lifespan individually. As
we add more fields, we will need to add more queries with this design.
This change combines requests into a single channel infor request so
that we do not need to add unnecessary boilerplate going forward.
2020-09-08 13:47:17 +02:00
Oliver Gugger
ba6156d41d
lnrpc+rpcserver: add ListPermissions RPC
As a convenience method for users to look up what RPC method URIs exist
and what permissions they require, we add a new ListPermissions call
that simply returns all registered URIs (including internal and external
subservers) and their required permissions.
2020-09-04 09:50:38 +02:00
Oliver Gugger
84879fddc6
rpcserver: allow to bake macaroons for specific URIs
To support the new URI specific permissions, we allow them to be added
in the BakeMacaroon call.
2020-09-04 09:22:36 +02:00
Oliver Gugger
3caca4fa3f
lnrpc+rpcserver: enable abandonchannel for externally funded chans
To make sure we can use the abandonchannel RPC for getting rid of
externally funded channels who's funding transaction was never
published, we allow the RPC to be used on non-dev builds for externally
funded and pending channels only.
2020-08-28 12:28:58 +02:00
Olaoluwa Osuntokun
63bd8e7776
Merge pull request #4527 from cfromknecht/configurable-remote-max-htlcs
fundingmanager: configurable remote max htlcs
2020-08-25 16:47:11 -07:00
Oliver Gugger
fac3c84806
Merge pull request #4551 from gkrizek/cors
lnd: Add CORS support to the WalletUnlocker proxy
2020-08-25 09:31:40 +02:00
Conner Fromknecht
a4031f500b
rpcserver+fundingmanager: thread remote_max_htlcs to channel opening 2020-08-24 20:11:33 -07:00
Graham Krizek
3f944dd337
lnd: Add CORS support to the WalletUnlocker proxy
This commit adds the same CORS functionality that's currently in the main gRPC proxy to the WalletUnlocker proxy. This ensures the CORS configuration is carried through all API endpoints
2020-08-24 14:29:31 -05:00
Olaoluwa Osuntokun
bd18f9acf5
Merge pull request #4427 from yyforyongyu/customize-root-key-id
macaroons: customize root key ID
2020-08-21 19:34:15 -07:00
Conner Fromknecht
d04df11c44
Merge pull request #4505 from Crypt-iQ/activeNet_cleanup_0803
lnd: removing activeNetParams global, passed around instead via configs
2020-08-20 12:59:15 -07:00
yyforyongyu
c8a2916d91
lncli: support list/delete on marcaroon IDs 2020-08-14 12:36:21 +08:00
yyforyongyu
c0e2513350
lnrpc+rpcserver: support list/delete on marcaroon IDs 2020-08-14 12:33:13 +08:00
Oliver Gugger
fe834bc0c0
rpcserver: don't allow closing restored channels
To avoid the scenario where the user tries to force close a channel too
early that was restored through SCB, we check the channel status in the
RPC server already. If a restored channel cannot connect to its peer and
mark it as local data loss the channel arbitrator would try to publish
the commitment TX it does not have and crash.
2020-08-12 16:03:35 +02:00
nsa
3791c9efcb lnd: removing activeNetParams global, passed around instead via configs
This commit removes the activeNetParams global in chainparams.go. This
is necessary to isolate code from the lnd package so we can import it
for use in tests, other projects, etc.
2020-08-11 11:41:24 -04:00
Olaoluwa Osuntokun
f58b00ef55
multi: split database storage into remote and local instances
In this commit, we split the database storage into two classes: remote
and local data. If etcd isn't active, then everything is actually just
local though we use two pointers everywhere. If etcd is active, then
everything but the graph goes into the remote database.
2020-08-07 18:44:02 -07:00
Olaoluwa Osuntokun
14a047ffba
Merge pull request #4455 from cfromknecht/psbt-no-publish
PSBT: add no_publish flag for safe batch channel opens v2
2020-07-20 12:04:10 -07:00
Olaoluwa Osuntokun
67b8bca5b2
rpc: allow outgoing wumbo channel requests if wumbo is enabled 2020-07-10 16:27:16 -07:00
Oliver Gugger
258996233f
lnwallet+rpcserver: add no_publish flag to PSBT assembler 2020-07-08 17:12:57 -07:00
carla
1d5d616da3
lnrpc: add channel resolutions to closed channels 2020-07-07 19:50:12 +02:00
Wilmer Paulino
9e8c39d4a2
Merge pull request #971 from vctt94/addMaxValueFlag
Add max value in flight flag
2020-07-07 10:29:51 -07:00
nsa
cbd54101f8 multi: remove peer.go, change all references to point to peer pkg 2020-07-06 19:16:07 -04:00
nsa
9be9d69349 multi: initialize peer with peer.Config 2020-07-06 19:16:07 -04:00
nsa
0dda9e06ce multi: exporting PendingUpdate, ChannelCloseUpdate, ErrorBufferSize 2020-07-06 19:16:06 -04:00
vctt94
2f6a8b13ae fundingmanager: Add max value to fundingmanager and fundingmanager_test 2020-07-03 11:09:40 -03:00
Wilmer Paulino
6075997ebc
multi: add relative thaw height interpretation
This is useful when we wish to have a channel frozen for a specific
amount of blocks after its confirmation. This could also be done with an
absolute thaw height, but it does not suit cases where a strict block
delta needs to be enforced, as it's not possible to know for certain
when a channel will be included in the chain. To work around this, we
add a relative interpretation of the field, where if its value is below
500,000, then it's interpreted as a relative height. This approach
allows us to prevent further database modifications to account for a
relative thaw height.
2020-07-02 12:05:49 -07:00
vctt94
474ce4ae25 server: Add max value in flight to server 2020-07-02 15:49:19 -03:00
yyforyongyu
f11da830b9 lnrpc: expose all local and remote channel constraints 2020-06-30 06:59:18 +08:00
yyforyongyu
987edc9d81 multi: add a rpc endpoint to track the recovery process 2020-06-25 15:49:54 +08:00
Roei Erez
7b56268f70 rpc: implement RPC htlc interceptor.
In this commit we add the ability to intercept forwarded htlc packets
straight from the RPC layer. The RPC layer handles a bidrectional stream
that comminucates to the client the intercepted packets and handles its
response by coordinating with the interceptable switch.
2020-06-18 15:20:07 +03:00
Anthony Ronning
a76e752f3b
config+lnd+rpcserver: add CORS origin config for REST 2020-06-17 08:34:55 +02:00
Oliver Gugger
6250ed1cf1
lnrpc: add WebSocket proxy 2020-06-17 08:34:54 +02:00
Wilmer Paulino
c2f1fe26c1
rpc: acquire global coin select lock in related RPCs
This ensures proper coin selection synchronization between lnd and users
of the RPC to avoid potential double spend errors.
2020-06-12 11:22:29 -07:00
Oliver Gugger
558d63718b
rpcserver+lnrpc: register REST subservers with root server 2020-06-04 08:50:44 +02:00
Wilmer Paulino
7616a3dc7f
rpc: refactor request validation and response marshal into functions 2020-06-03 18:50:11 -07:00
Joost Jager
df7a05da84
rpcserver+routerrpc: remove payment limit 2020-05-28 19:34:17 +02:00
Conner Fromknecht
3faf8bad3f
Merge pull request #4320 from guggero/refactor-log-writer
config+log: remove global RootLogWriter variable
2020-05-27 19:25:32 -07:00
Olaoluwa Osuntokun
d2d8793afd
Merge pull request #4298 from cfromknecht/sub-inv-fixes
channeldb+invoices: minor invoice subscription fixes
2020-05-27 15:56:47 -07:00
Oliver Gugger
70772ab99b
config+lnd+rpcserver: use log writer from cfg 2020-05-27 09:43:59 +02:00
Conner Fromknecht
d0d2ca403d
multi: rename ReadTx to RTx 2020-05-26 18:20:37 -07:00
Conner Fromknecht
5b747715fc
invoices: return error from SubscribeNotifications on shutdown 2020-05-26 17:50:45 -07:00
Oliver Gugger
3afaed8b5c
rpcserver: fix linter error 2020-05-20 09:12:53 +02:00
Oliver Gugger
7f1b865b53
multi: rename server's identityPriv to identityECDH 2020-05-20 09:05:14 +02:00
carla
099161ed0b
multi: add label to WalletController SendOutputs and dependent rpcs
Add a label parameter to the WalletController SendOutputs endpoint and
update rpcs that use it to allow optional provision of labels.
2020-05-19 13:31:51 +02:00
carla
75370ce6b4
multi: update WalletController PublishTransaction to include label
Add label parameter to PublishTransaction in WalletController
interface. A labels package is added to store generic labels that are
used for the different types of transactions that are published by lnd.

To keep commit size down, the two endpoints that require a label
parameter be passed down have a todo added, which will be removed in
subsequent commits.
2020-05-19 13:30:00 +02:00
Olaoluwa Osuntokun
c2516d9352
Merge pull request #4286 from guggero/remove-global-cfg
multi: remove global cfg variable
2020-05-18 19:45:43 -07:00
Wilmer Paulino
b195d39ad7
rpc: use existing rpc logger for wtclientrpc
The logger string used to identify the wtclient and wtclientrpc loggers
was the same, leading to being unable to modify the log level of the
wtclient logger as it would be overwritten with the wtclientrpc's one.
To simplify things, we decide to use the existing RPC logger for
wtclientrpc.
2020-05-14 13:35:03 -07:00
Oliver Gugger
50e86f88fe
rpcserver+subrpcserver: don't use global cfg 2020-05-14 16:18:02 +02:00
Oliver Gugger
4343f9e9a6
server+rpcserver: don't use global cfg 2020-05-14 16:18:01 +02:00
Oliver Gugger
7e4d0aba2f
lnd+rpcserver: don't use global cfg 2020-05-14 16:18:01 +02:00
Oliver Gugger
d44f205e3f
multi: move global networkDir to cfg 2020-05-14 14:47:35 +02:00
Oliver Gugger
85d5cdfbfd
multi: move global registeredChains to cfg 2020-05-14 14:47:35 +02:00
Oliver Gugger
a7e78112b7
multi: allow external subservers to register themselves
With two new callbacks we allow processes that use lnd as a library
to register additional gRPC and REST subservers to the main server
instances that lnd creates.
2020-05-14 14:47:33 +02:00
Oliver Gugger
bc3909050e
multi: rename and export logWriter as RootLogWriter 2020-05-14 14:37:50 +02:00
Conner Fromknecht
2f84d1a819
Merge pull request #4280 from cfromknecht/read-for-each-node
channeldb: remove Tx arg from ForEachNode
2020-05-13 16:37:10 -07:00
Conner Fromknecht
90d3bf532d
channeldb+routing: remove tx arg for ForEachNode 2020-05-12 17:53:20 -07:00
Joost Jager
674c199047
routing: return full htlc attempt from router 2020-05-12 19:56:52 +02:00
Joost Jager
c33d94ff27
routing+routerrpc: add multiple outgoing channel restriction 2020-05-12 07:17:24 +02:00
Olaoluwa Osuntokun
3190437188
Merge pull request #4139 from carlaKC/lnrpc-listsweeps
lnrpc: add block height params to GetTransactions and add ListSweeps
2020-05-07 16:44:05 -07:00
carla
f3212057dd
walletrpc: add list sweeps to rpc and cli 2020-05-06 09:25:44 +02:00
carla
537dac3c62
multi: specify start and end height for ListTransactionDetails
Add start and end height parameters to the rpc and cli GetTransactions
endpoints. Default to returning all transactions from genesis to tip,
including unconfirmed transactions to maintain backwards compatibility.
2020-05-05 21:10:06 +02:00
Olaoluwa Osuntokun
cc1dbb5677
channeldb: eliminate extra copy in QueryPayments
In this commit, we eliminate an extraneous copy in the `QueryPayments`
method. Before this commit, we would copy each payment from the initial
FetchPayments call into a new slice. However, pointers to payments are
return from `FetchPayments`, so we can just maintain that same reference
rather than copying again when we want to limit our response.
2020-05-04 12:13:47 -07:00
Conner Fromknecht
1bfe52837d
Merge pull request #4176 from wpaulino/listchannels-uptime-before-server-active
rpcserver: omit uptime in ListChannels response if server not started
2020-04-30 20:33:37 -07:00
Olaoluwa Osuntokun
9f5f48b20d
Merge pull request #4089 from fguisso/acceptor
rpcserver: parameterize acceptortimeout
2020-04-30 19:03:55 -07:00
Joost Jager
f6b2410011
routing+routerrpc: rename max_shards to max_parts
Don't introduce a new term and align with the P in MPP.
2020-04-22 14:49:19 +02:00
Joost Jager
969eecc7d2
routing+routerrpc+lncli: rename MaxHtlcs to MaxShards 2020-04-14 10:31:59 +02:00
Wilmer Paulino
893c0cf843
rpcserver: omit uptime in ListChannels response if server not started
If the server hasn't fully started yet, it's possible that the channel
event store hasn't either, so it won't be able to consume any requests
until then. To prevent blocking, we'll just omit the uptime related
fields for now.
2020-04-10 18:31:46 -07:00
Wilmer Paulino
17ca1d78f0
rpcserver: include upfront shutdown script in ListChannels response
This field could be omitted from the response if we were unable to
calculate the channel's uptime.
2020-04-10 18:26:31 -07:00
Conner Fromknecht
91cd7e633a
lnrpc+rpcserver: expose git commit hash in getinfo 2020-04-10 16:39:31 -07:00
Conner Fromknecht
5c04038c18
bulid: only return semantic version from Version()
The version field in getinfo is kept the same for backwards
compatibility.
2020-04-10 16:39:23 -07:00
Olaoluwa Osuntokun
363caa441a
rpc: allow wumbo invoices
In this commit, we remove the restriction surrounding the largest
invoices that we'll allow a user to create. After #3967 has landed,
users will be able to send in _aggregate_ a payment larger than the
current max HTLC size limit in the network. As a result, we can just
treat that value as the system's MTU, and allow users to request
payments it multiples of that MTU value.

A follow up to this PR at a later time will also allow wumbo _channels_.
However, that requires us to tweak the way we scale CSV values, as post
wumbo, there is no true channel size limit, only the
_local_ limit of a given node. We also need to implement a way for nodes
to signal to other nodes their accepted max channel size.
2020-04-09 19:02:08 -07:00
Joost Jager
e9bd691e6a
routerrpc+routing: adapt payment session for multi shard send
Modifies the payment session to launch additional pathfinding attempts
for lower amounts. If a single shot payment isn't possible, the goal is
to try to complete the payment using multiple htlcs. In previous
commits, the payment lifecycle has been prepared to deal with
partial-amount routes returned from the payment session. It will query
for additional shards if needed.

Additionally a new rpc payment parameter is added that controls the
maximum number of shards that will be used for the payment.
2020-04-09 08:20:49 +02:00
Joost Jager
327634e9f7
routerrpc: move payment marshalling 2020-04-08 08:53:57 +02:00
bitromortac
39c58d9d14 lnrpc: use queried payments to list payments in the rpc
Changes the grpc proto file, generates the protobuf, and
enables a queried way to retrieve payments in the rpc, where
backward compatibility is enforced by returning all payments
in the database by default. Adds a payment index field to
the returned payments of the rpc call.
2020-04-07 07:03:51 +02:00
Olaoluwa Osuntokun
e52c5df8ab
Merge pull request #4140 from carlaKC/lnrpc-pendingchannelinitiator
lnrpc: use initiator enum for pending channel open initiator
2020-04-06 15:46:46 -07:00
carla
d66ff04583
lnrpc: use initiator enum for pending channel channel intiator
Update the PendingChannel message from a bool to an enum to
differentiate between the case where the remote party initiated the
channel and we have no record of the channel initiator. The previous
field has not been included in a release of lnd, so we can replace the
field directly.
2020-04-03 11:26:21 +02:00