Commit Graph

11169 Commits

Author SHA1 Message Date
Johan T. Halseth
6046c5cf86
Merge pull request #5119 from ellemouton/lncli-start-signal-interceptor
lncli: start signal interceptor in getContext
2021-03-18 09:30:11 +01:00
Johan T. Halseth
d53633eab5
Merge pull request #5005 from halseth/walletunlocker-unify-staterpc
[RPC] SubscribeState RPC for getting unlocking state of wallet and RPC
2021-03-18 08:41:07 +01:00
Olaoluwa Osuntokun
0a1d592cf9
channeldb: return more detailed errors in DeleteInvoice
This PR was created in order to help to debug the failures in:
https://github.com/lightningnetwork/lnd/issues/5113

We add some more contextual errors so we can figure out where the
assumptions of the current scan to delete function in the invoice
registry is incorrect.
2021-03-17 14:22:46 -07:00
Elle Mouton
000516ec4d lncli: start signal interceptor in getContext
signal Intercept function needs to be called if the signal shutdown
channel will be listened on.
2021-03-17 22:44:45 +02:00
Conner Fromknecht
e2690918a0
Merge pull request #5002 from akovalenko/master
lncli addinvoice: allow specifying msat with --amt_msat
2021-03-17 10:03:56 -07:00
Conner Fromknecht
482ca0ddc4
Merge pull request #5068 from wpaulino/gossip-rate-limit-config
lncfg: expose channel update rate limiting options
2021-03-17 09:58:53 -07:00
yyforyongyu
2dac77200b
lncli+lnrpc: add payment address to sendpayment 2021-03-17 21:16:17 +08:00
Johan T. Halseth
b4bc6f918e
lncli: add state command 2021-03-17 12:09:38 +01:00
Johan T. Halseth
9ef556624e
lnrpc: add StateService 2021-03-17 12:09:38 +01:00
Joost Jager
56238ebc60 routing: remove unnecessary lock in mission control init
The init code is part of the instantiation, so there is no need for
locking yet.
2021-03-17 12:06:12 +01:00
Joost Jager
89751f869f routing: fix mission control deadlock
This commit fixes the following potential deadlock situation:
* Pathfinding holds a database lock and tries to obtain a mission control lock
via GetProbability
* ReportPaymentSuccess/ReportPaymentFail holds a mission control lock
and tries to obtain a database lock to store the payment result.
2021-03-17 12:03:32 +01:00
Johan T. Halseth
419ad86209
Merge pull request #5112 from halseth/walletunlocker-mac-responsechan-close
lnd: close MacResponseChan when wallet is unlocked
2021-03-17 10:40:25 +01:00
Oliver Gugger
05342f25b8
Merge pull request #5097 from ellemouton/lncli-interrupt-handler
lncli: cancel RPC context on OS interrupts
2021-03-17 10:31:08 +01:00
Wilmer Paulino
022d44f776
itest: test new channel update rate limiting options 2021-03-16 12:08:18 -07:00
Wilmer Paulino
dcac5a87f4
lncfg: expose channel update rate limiting options 2021-03-16 11:42:29 -07:00
Conner Fromknecht
b4aa661d16
Merge pull request #5064 from ellemouton/set-coop-close-target-confs
multi: allow setting target confs for co-op close
2021-03-16 11:14:15 -07:00
Conner Fromknecht
53c1175407
Merge pull request #5111 from yyforyongyu/fix-feature-check
routing: check payment.DestFeatures against nil
2021-03-16 10:01:00 -07:00
yyforyongyu
541fbbb054
routing: check payment.DestFeatures against nil 2021-03-17 00:14:20 +08:00
Johan T. Halseth
ad6673c21d
lnd: close MacResponseChan when wallet is unlocked
After unification of the WalletUnlocker and RPC services on the same gRPC
server, the WalletUnlocker will no longer be shut down after the wallet
has been unlocked.

In case --no-macaroons was used, this lead to the caller getting stuck
after unlocking the wallet, since we would wait for a response on the
MacResponseChan. Earlier we would close the MacResponseChan always
when shutting down the WalletUnlocker, but this is no longer done.

To fix this we close this channel after the wallet is unlocked,
regardless of which combination of --no-macaroons and --noseedbackup
that is being used.
2021-03-16 14:47:02 +01:00
Joost Jager
9398220568 walletrpc: add ListLeases 2021-03-13 08:45:52 +01:00
Joost Jager
b8e54fffbf walletrpc: extract leases marshall function 2021-03-13 08:45:52 +01:00
Joost Jager
37331a5ab2 walletrpc: use locked utxo struct from wtxmgr 2021-03-13 08:45:52 +01:00
Joost Jager
927f17be32 walletrpc: parameterize output lease duration 2021-03-13 08:45:52 +01:00
Joost Jager
5ba0f8e355 lnwallet: bump btcwallet 2021-03-13 08:45:52 +01:00
whythat
54c93b1b86 lncli: cancel RPC context on OS interrupts 2021-03-12 10:07:49 +02:00
Johan T. Halseth
fa4155c126
Merge pull request #5086 from halseth/mobile-graceful-exit
mobile: gracefully exit if lnd fails to start
2021-03-11 20:02:11 +01:00
Johan T. Halseth
fd76b879a2
Merge pull request #4985 from halseth/walletunlocker-unify-jan21
[gRPC] WalletUnlocker and RPCServer unification
2021-03-11 14:00:00 +01:00
Johan T. Halseth
148f1be75f
itest: add RPC errors to whitelist
Since we now log RPC errors as the first thing in our interceptor chain,
more benign errors bubble up. We add them to the whitelist.
2021-03-11 13:05:24 +01:00
Johan T. Halseth
b2e0a7d684
rpcperms: export macaroon interceptor methods
Since we need access to these methods from external subservers in some
cases, we export them.
2021-03-11 13:05:24 +01:00
Johan T. Halseth
2877511fce
rpcperms+lnd: gate RPC calls on RPC state
This commit makes us gate the calls to the RPC servers according to the
current RPC state. This ensures we won't try to call the RPC server
before it has been fully initialized, and that we won't call the
walletUnlocker after the wallet already has been unlocked.
2021-03-11 13:05:24 +01:00
Johan T. Halseth
0d7763fb96
walletunlocker: expose WalletExists 2021-03-11 13:05:24 +01:00
Johan T. Halseth
5e9e03858d
lntest/node: call FetchNode info in wait.NoError after init
In case we call it before the RPC server is fully active.
2021-03-11 13:05:24 +01:00
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
73711941ad
rpcperms: add macaroon whitelist
We extract common macaroon validating code into a method, and add a
method whitelist, for methods that won't need macaroons.

This give us explicit control over which methods don't require
macaroons, to avoid inadvertently adding RPCs that are unauthenticated.

For now this whitelist contains the WalletUnlocker methods, as the
wallet password is required to open the macaroon db.
2021-03-11 13:05:23 +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
Oliver Gugger
c623d21bd2
Merge pull request #5083 from guggero/psbt-size-fix
lncli: allow PSBT to be read from file
2021-03-10 23:02:02 +01:00
Conner Fromknecht
7e33548e8b
Merge pull request #4775 from halseth/input-tx-size-constants
[input/size] Check tx size constants
2021-03-10 09:23:40 -08:00
Oliver Gugger
f55aae0068
itest: add new neutrino error to whitelist 2021-03-10 16:55:49 +01:00
Oliver Gugger
b3dfe5d1af
lncli: allow PSBT to be read from file
Fixes #5080.

The N_TTY_BUF_SIZE kernel parameter dictates how many characters can be
pasted into a terminal window. This cannot be circumvented by reading
the input in a different manner.
To avoid the problem fully, we instead allso allow the user to type in a
path to a text file that is read if it exists. That way the PSBT can be
as long as needed.
2021-03-10 12:46:33 +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
Olaoluwa Osuntokun
dd13dbe613
Merge pull request #5072 from cfromknecht/fix-tlv-bench
tlv: fix ESatPerKw in benchmark
2021-03-09 16:42:58 -08:00
Johan T. Halseth
8038e9f322
mobile: gracefully exit if lnd fails to start
Instead of killing the app, report an error back to the application.
2021-03-09 14:25:46 +01:00
Eugene
6dca38c561
Merge pull request #5073 from Crypt-iQ/writemessage_03042021
lnwire: remove MaxPayloadLength from lnwire.Message interface
2021-03-09 04:50:40 -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
Olaoluwa Osuntokun
3c14e3d71d
Merge pull request #4517 from Crypt-iQ/2659_keyloc
multi: store KeyLocator in OpenChannel, use ECDH instead of DerivePrivKey
2021-03-05 16:12:49 -08:00
Conner Fromknecht
8c4e32012e
Merge pull request #5070 from alexbosworth/patch-14
trivial: match newline style
2021-03-05 12:30:20 -08:00
Conner Fromknecht
b121d1da4e
Merge pull request #5078 from carlaKC/fix-comment
lnrpc: correct comment on half life seconds
2021-03-05 12:29:59 -08:00
Conner Fromknecht
e7f3fe3923
Merge pull request #5074 from cfromknecht/add-invalid-onion-payload-rpc
lnrpc: expose INVALID_ONION_PAYLOAD via RPC
2021-03-05 09:50:47 -08:00