Commit Graph

767 Commits

Author SHA1 Message Date
Johan T. Halseth
4bbf5c4b6d
rpcserver: use same grpc server for both services
This commit achieves what we have been building up to: running the
WalletUnlockerService and the LightningService on the same gRPC server
simultaneously!

To achieve this, we first create the RPC server in a "interface only"
way, only creating the struct and setting the dependencies we have
available before the wallet has been unlocked. After the wallet has been
unlocked and we have created all the subsystems we need, we add those to
the RPC server, and start the sub-servers.

This means that the WalletUnlockerService and the LightningService both
will be registered and available at all times on the gRPC server.
However, before the wallet has been unlocked, the LightningService
should not be used since the RPC server is not yet ready to handle the
calls. Similarly, after the wallet has been unlocked, the
WalletUnlockerService should not be used. This we will ensure in
following commits.
2021-03-11 13:05:24 +01:00
Johan T. Halseth
82fb22eda2
lnd+rpc: define external subserver config only once
We don't have to define the external subserver config more than once, so
it is not needed to be defined for every listener. Instead we move it to
the ListenerConfig.
2021-03-11 13:05:24 +01:00
Johan T. Halseth
3c81a5dd73
rpcperms: add RPC interceptor chain
This adds a new package rpcperms which houses the InterceptorChain
struct.  This is a central place where we'll craft interceptors to use
for the GRPC server, which includes macaroon enforcement.

This let us add the interceptor chain to the GRPC server before the
macaroon service is ready, allowing us to avoid tearing down the GRPC
server after the wallet has been unlocked.
2021-03-11 13:05:23 +01:00
Johan T. Halseth
4ea494e8c5
lnrpc: wrap subservers in GrpcHandler
In order to be able to register the subservers with the root grpc server
before we have all dependencies available, we wrap them in an
GrpcHandler struct. This struct will initially hold an empty reference
to the subservers, which allows us to register with the GRPC server, and
later populate and create the subserver instance.
2021-03-11 13:05:23 +01:00
Olaoluwa Osuntokun
65b0bbcd53
Merge pull request #5033 from robot-dreams/set-channel-status
Add lncli command / RPC for manually setting channel state
2021-03-09 18:12:08 -08:00
Yaacov Akiba Slama
4bab68a808 lnrpc: add timestamp_ns field to ForwardingEvent msg
This allows to use FowardingHistory rpc method to receive the data exactly
as it's stored in lnd and to synchronize incrementally the history to an
external database.
2021-03-05 16:26:28 -08:00
Elliott Jin
ce2796257e multi: move GetChanPointFundingTxid from lnd to lnrpc
This refactor-only change makes the GetChanPointFundingTxid helper
function available from sub-systems outside of the root lnd package.
2021-02-24 07:13:28 -08:00
Elliott Jin
db76b970ac routerrpc: expose SetChannel* methods from Router backend
Allow router RPC requests to call into the ChanStatusManager to
manually update channel state.
2021-02-24 07:13:28 -08:00
Johan T. Halseth
59f41e518d
channeldb: add failedHtlcsOnly option to DeletePayments 2021-02-22 12:50:25 +01:00
Johan T. Halseth
7e3738d773
rpcserver+channeldb: delete only failed payments if requested 2021-02-22 12:50:25 +01:00
Conner Fromknecht
7f006832fb
Merge pull request #4934 from cfromknecht/pinned-active-syncers
discovery: pinned syncers
2021-02-03 10:54:00 -08:00
Andras Banki-Horvath
dde5750160
invoices+rpc: add missing channel graph to the AddInvoiceConfig
The Graph which is referenced later in the AddInvoice call graph is
unset when adding a hodl invoice. This resulted in a crash.
2021-02-03 11:33:27 +01:00
Conner Fromknecht
bd1c5378bf
Merge pull request #4919 from joostjager/getnodeinfo-notfound
rpcserver: use NotFound http status code in GetNodeInfo
2021-01-31 09:43:33 -08:00
Conner Fromknecht
2371fc5a8e
lnrpc: expose PINNED_SYNC for listpeers 2021-01-29 00:19:47 -08:00
Johan T. Halseth
422008e3c0
lnwallet+funding+rpcserver: check reserved value before
PublishTransaction

For a few manual send cases that can be initiated by the user, we check
the reserved value.
2021-01-19 20:06:52 +01:00
Johan T. Halseth
185ba77f8e
sweep: allow specified outputs to sweep tx
We'll use this to attach an output for the value reserved for anchor
commitments fee bumping if the user requests a send_all transaction.
2021-01-19 10:53:45 +01:00
Joost Jager
626983b352 rpcserver: use NotFound http status code in GetNodeInfo 2021-01-14 13:59:56 +01:00
Oliver Gugger
49edb2b524
rpcserver: fix log statement in channelbalance
Fixes a typo and missing format 'verb' in the RPCS debug log.
2020-12-22 09:39:43 +01:00
eugene
dcdf36f410 lnd+funding: move Manager to funding, change references 2020-12-17 10:45:05 -05:00
eugene
936227798a lnd: remove openChanReq, call InitFundingWorkflow with InitFundingMsg 2020-12-17 09:50:48 -05:00
eugene
caa0f5da6a multi: move and export funding-related vars to funding package
Also moves the lnd global MaxFundingAmount to server.go
2020-12-17 09:36:34 -05:00
Johan T. Halseth
e13c97d621
Merge pull request #4841 from cfromknecht/send-coins-log-fix
rpcserver: replace sweep_all in log with send_all to match rpc arg
2020-12-08 13:56:41 +01:00
Conner Fromknecht
b017ab67c4
rpcserver: replace sweep_all in log with send_all to match rpc arg 2020-12-07 13:45:11 -08:00
Andras Banki-Horvath
98c61be342
routing: add missing GlobalFeatures to NetworkNodeUpdate 2020-12-07 15:47:09 +01:00
Olaoluwa Osuntokun
94f8311667
Merge pull request #4782 from cfromknecht/anchor-wtserver
watchtower: anchor channel support
2020-11-30 17:49:32 -08:00
Olaoluwa Osuntokun
43fc84919e
lnrpc: include payment addr in main Invoice proto
With this change ListInvoices will return the payment addr, and the
response to AddInvoice will as well.
2020-11-25 16:32:05 -08:00
Conner Fromknecht
5b3a08a1cd
multi: thread anchor client down to wtclient subserver 2020-11-25 16:16:28 -08:00
Johan T. Halseth
aa8fa9d0cf
sweep: pass dustLimit to CreateSweepTx 2020-11-20 13:06:53 +01:00
Olaoluwa Osuntokun
99b0913562
Merge pull request #3672 from breez/invoice-hints
Allow user specify routing hints in private invoice.
2020-11-11 19:57:49 -08:00
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