Commit Graph

11560 Commits

Author SHA1 Message Date
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
eugene
99a7271289
lntest/itest+lnwallet: add legacy chanrestore test
The test makes use of a nextRevocationProducer that is only used during
integration tests.
2021-03-05 12:49:18 -05:00
eugene
bb84f0ebc8
multi: store KeyLocator in OpenChannel, use ECDH
This commit adds a RevocationKeyLocator field to the OpenChannel
struct so that the SCB derivation doesn't have to brute-force the
sha chain root key and match the public key. ECDH derivation is now
used to derive the key instead of regular private key derivation a
la DerivePrivKey. The legacy can still be used to recover old
channels.
2021-03-05 12:49:18 -05:00
eugene
986e69c81b
channeldb: add KeyLocator Record 2021-03-05 12:49:16 -05:00
carla
cd1a8b2d3a
lnrpc: correct comment on half life seconds
Field is not a unix timestamp, it's just number of seconds.
2021-03-05 16:26:02 +02:00
Johan T. Halseth
d30aae43e6
input/size: add txSize test
Similar to what we do for witnesses, check that the HTLC weight
constants check out.

They actually do not, since the spec is off by one. We ensure we agree
with the spec.
2021-03-05 10:58:42 +01:00
Johan T. Halseth
2bc37db61a
lnwallet: export HTLC generating methods 2021-03-05 10:58:42 +01:00
Johan T. Halseth
3a3076397a
input/size: fix comments for constants
We run a script that ensures the constant sizes listed is actually the
value of the constant.
2021-03-05 10:58:42 +01:00
Johan T. Halseth
fe71c905e5
input/size: split constants into confirmed/non-confirmed
This to more easily track mismatches if constants and get more accurate
fee estimates for the two channel types.

The non-anchor weight estimates will now be smaller, this is okay since
these constants are only being used for fee estimation (and will now be
more accurate).
2021-03-05 10:58:42 +01:00
Conner Fromknecht
71db3a83bc
lnrpc: expose INVALID_ONION_PAYLOAD via RPC 2021-03-04 15:27:16 -08:00
eugene
7ff04d8bad
lnwire: remove MaxPayloadLength from Message interface
Removes the MaxPayloadLength function from the Message interface
and checks that each message payload is not greater than MaxMsgBody.
Since all messages are now allowed to be 65535 bytes in size, the
MaxPayloadLength is no longer needed.
2021-03-04 16:48:10 -05:00
Conner Fromknecht
56b61078c5
Merge pull request #4338 from cfromknecht/set-id-index
channeldb+invoices: add set id index for AMP
2021-03-04 12:17:08 -08:00
Conner Fromknecht
68688d6346
invoices: replace all asserts with requires 2021-03-04 10:11:22 -08:00