Commit Graph

381 Commits

Author SHA1 Message Date
Elle Mouton
387a1a8831
build: separate sublogger and rotator pipe management
These are two separate concerns. So this commit splits them up and just
passes a LogWriter from the one to the other. This will become cleaner
in an upcoming commit where the Rotator will implement io.Writer and
there will no longer be a need for LogWriter.
2024-10-22 15:19:58 +02:00
ziggie
448193b0fd
multi: separate profiler config 2024-10-18 13:03:30 +02:00
Viktor Tigerström
52b3a06733
lnd: allow shutdown signal during IsSynced check
Prior to this commit, lnd could become unresponsive to shutdown signals
during the `IsSynced` check. Since the `IsSynced` check can occasionally
take a long time to complete, this could result in lnd failing to shut
down promptly.
2024-10-01 11:42:47 +02:00
ffranr
008d265cdb
invoicesrpc: add HTLC modifier to invoices RPC server
This commit integrates the HTLC modifier service into the
invoices RPC server.
2024-09-19 09:21:37 +02:00
Oliver Gugger
b45d72fe59
multi: thread thru the AuxLeafStore everywhere 2024-08-28 13:26:14 +02:00
Olaoluwa Osuntokun
b028af1836 multi: make MsgRouter available in the ImplementationCfg
With this commit, we allow the `MsgRouter` to be available in the
`ImplementationCfg`. With this, programs outside of lnd itself are able
to now hook into the message processing flow to direct handle custom
messages, and even normal wire messages.
2024-08-14 19:23:02 -07:00
Olaoluwa Osuntokun
4a3c4e4ba7
Merge pull request #8497 from ziggie1984/shutdown-bugfix
routing: shutdown chanrouter correctly.
2024-08-01 16:48:50 -07:00
Andras Banki-Horvath
8e0534f756
multi: add leader check to the healthcheck monitor
This commit extends our healtcheck with an optional leader check. This
is to ensure that given network partition or other cluster wide failure
we act as soon as possible to avoid a split-brain situation where a new
leader is elected but we still hold onto our etcd client.
2024-08-01 19:04:10 +02:00
ziggie
653e2f3667
multi: Allow interrupt of server startup.
This commit does two things. It starts up the server in a way that
it can be interrupted and shutdown gracefully.
Moreover it makes sure that subsystems clean themselves up when
they fail to start. This makes sure that depending subsytems can
shutdown gracefully as well and the shutdown process is not stuck.
2024-07-31 13:12:19 +02:00
erik
ab83343c87 multi: repleace ioutil.ReadFile 2024-04-25 11:22:43 +02:00
Oliver Gugger
648fb22f63
multi: wrap all errors 2024-04-11 15:04:03 +02:00
ffranr
cd566eb097
multi: fix fmt.Errorf error wrapping
Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
2024-02-27 11:13:40 +00:00
Amin Bashiri
039e9effe7
lnd: add http header timeout to config 2023-10-11 22:05:50 -06:00
Elle Mouton
031dbd7760 multi: remove ChainRegistry 2023-10-06 16:34:47 -07:00
Elle Mouton
3912d5a0c6 multi: remove Litecoin config options
This commit removes the `Litecoin`, `LtcMode` and `LitecoindMode`
members from the main LND `Config` struct. Since only the bitcoin
blockchain is now supported, this commit also deprecates the
`cfg.Bitcoin.Active` config option.
2023-10-06 16:34:47 -07:00
Olaoluwa Osuntokun
23a153abae
lnd+config: add ability to obtain blocking and mutex profiles
In this commit, we add the ability to obtain blocking and mutex
profiles. The blocking profile will show which goroutines are
consistently blocked on synchronization primitives like channels, or
I/O. The mutex profile will show which mutexes are very contested.

The blocking profile can be enabled with a new arg: `--blockingprofile`.
The mutex profile can be enabled with a new arg: `--mutexprofile`. These
are both ignored if the profile port isn't set.

Activating these profiles requires the caller to pass in a sampling
rate. For now I've set it just to `1` to test things out. Unfortunately
documentation is rather scarce, so there aren't any good guides re what
these values should be set to. AFAICT, these add more overhead than the
other prowling options, so they shouldn't necessarily be enabled
persistently in production.
2023-09-18 11:44:49 -07:00
Elle Mouton
b9560b067a
refactor: move State server REST registration
This commit moves the registration of the State server with a REST proxy
into the `RegisterWithRestProxy` method in order to keep all the REST
registrations in one place.
2023-08-08 11:43:25 +02:00
yyforyongyu
148732af61
lnd: fix pprof server redirects 2023-06-22 01:23:27 +08:00
yyforyongyu
bd205aac13
lnd: add debug log when syncing blocks 2023-06-19 14:53:56 +08:00
Oliver Gugger
f9f8f6406b
config+lnd: allow configuring gRPC keepalive settings
This change allows users to customize the gRPC keepalive settings. The
server ping values configure when the server sends out a ping by itself
and how quickly the client is expected to respond.
The client ping min wait configures the minimum time a client has to
wait before sending another ping. A connection might be closed by the
server if a client pings more frequently than the allowed min wait time.

We choose lower default values than the gRPC library used before:
 - ServerPingTime: 1 minute instead of 2 hours
 - ClientPingMinWait: 5 seconds instead of 5 minutes

This should by itself already make long-standing gRPC streams more
stable but also allow clients to set a custom client ping time of 5
seconds or more (a value of slightly more than 5000 milliseconds should
be chosen to avoid the server disconnecting due to slight timing skews).
2023-06-09 10:57:36 +02:00
Oliver Gugger
f9436ec05d
mod+cmd/lncli: use google.golang.org/protobuf package 2023-05-11 22:51:16 +02:00
Daniel McNally
16463d4bd4
lnd: generate default macaroons independently
This modifies the `genMacaroons` logic to indepently check for each of
the three default macaroons (admin, readonly, invoice) and generate
whichever are missing. Previously, this was an all or nothing routine.
In other words, either all three didn't exist on disk and all three are
created, or no macaroons are created. Although that works for the first
run of a new node, it can result in inconsistent states if only one or
two of the macaroons is deleted.

See https://github.com/lightningnetwork/lnd/discussions/7566.
2023-04-26 13:30:03 -04:00
yyforyongyu
4243c5b95f
lnd: properly shutdown the optional pprof server
This commit makes sure when lnd is shutting down, the optional pprof
server is also gracefully shutting down.
2023-04-20 18:52:46 +08:00
Orbital
c0f44a17b7
lnd: Add ability to encrypt TLS key on disk 2023-01-26 13:32:11 -06:00
Orbital
60be9085c3
lnd: Move TlsManager files to new files 2023-01-26 13:32:11 -06:00
Orbital
7e03297b1b
lnd: refactor getTLSConfig 2023-01-26 13:32:11 -06:00
Kody Low
c89dd86a2e fix typo 2022-10-27 16:26:47 -07:00
Orbital
073c990c75
multi: Add --tor.encryptkey flag functionality to encrypt the Tor private key on disk
It's possible that a user might not want the Tor private key to sit on the disk in plaintext (it is a private key after all). So this commit adds a new flag to encrypt the Tor private key on disk using the wallet's seed. When the --tor.encryptkey flag is used, LND will still write the Tor key to the same file, however it will now be encrypted intead of plaintext. This essentially uses the same method to encrypt the Tor private key as is used to encrypt the Static Channel Backup file.
2022-09-30 01:53:46 -05:00
Olaoluwa Osuntokun
be5bc79444
Merge pull request #6716 from Crypt-iQ/zeroconfacceptor
multi: add zeroconfacceptor to default reject incoming channels
2022-08-12 14:20:11 -07:00
eugene
c2a4a9adbc
multi: add zeroconfacceptor that default rejects if no rpc acceptors
This is a safety mechanism so that zero-conf channels are not accepted
by default if no rpc acceptor exists.
2022-08-12 16:30:42 -04:00
Olaoluwa Osuntokun
dc16f5df53
watchtower: uses P2TR for sweep, delivery, and reward addresses
In this commit, we modify the watch tower to use P2TR addrs for just
about anything sweep related.

One eye sore in this diff are the changes to
`backup_task_internal_test.go`. All the values are hard coded, and now
either differ by a value of 48, or needed to be modified to account for
the new assumptions propagated to rewards values and fees.
2022-08-11 17:26:13 -07:00
Oliver Gugger
1dc2a394e6
lnd: disable REST proxy HTTP method fallback
It turns out that when a REST call to an endpoint (in this specific
example /v1/payments, which for GET returns all payments but for DELETE
removes all payments) is made with POST instead of the correct
registered method, the grpc-gateway tried to find a fallback method.
That resulted in randomly choosing between any of the calls with the
same URI pattern.
This is of course catasrophic if the user attempts to query the list of
payments (but using POST instead of GET by accident) and then ending up
calling the DELETE endpoint instead.
2022-03-23 17:40:35 +01:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Oliver Gugger
dfdc2bff8b
multi: run gosimports 2022-02-10 11:02:01 +01:00
Rafe
62dc1b5323 multi: Update Licenses to 2022 [skip ci] 2022-02-09 00:25:20 +02:00
Oliver Gugger
b77c1fb200
Merge pull request #6149 from bhandras/graph_import_rpc
lnd: add `devrpc` sub server and `devrpc.ImportGraph` to import graph dumps
2022-01-28 10:24:59 +01:00
Andras Banki-Horvath
eeea141e01
lnd: allow large GRPC messages 2022-01-24 17:43:00 +01:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
Oliver Gugger
602d2065eb
lnd: make sure error is logged to file
Fixes #5936.
This commit makes sure every error that causes the Main() function to
return is logged to the log file in addition to being printed to stderr.
2021-11-08 15:15:27 +01:00
Oliver Gugger
338afef862
lnd: standardize printing to stdout
With this commit we standardize the error messages in the config parsing
section of the main package. We only print to stdout/stderr in a single
place and also make sure the same error is printed to the log (which
might or might not yet be initialized at that point).
2021-11-08 15:12:56 +01:00
Oliver Gugger
87c5b76e4d
lnd: simplify listener creation 2021-11-05 10:49:37 +01:00
Oliver Gugger
9fa9dd8e43
multi: extract key ring creation from chain control
To make it possible to supply our own implementation of a secret key
ring, we extract that part from the chain control and split the whole
chain control creation into two parts.
2021-10-14 15:42:47 +02:00
Oliver Gugger
e1da1f8941
multi: extract wallet initialization
With this commit we extract the wallet creation/unlocking and
initialization completely out of the main function. This will allow us
to use custom implementations in the future.
2021-10-08 12:13:15 +02:00
Oliver Gugger
047d8ea3bc
config_builder+lnd: move wallet related code
We move some of the wallet related functions into the new file that
houses the new customizable implementations for some of our interfaces.
Since the next customizable interface will be the wallet, we move those
wallet and chain backend related helper functions.
NOTE: This is a pure code move.
2021-10-08 12:08:25 +02:00
Oliver Gugger
f6d7e70f51
multi: extract database initialization 2021-10-08 12:08:25 +02:00
Oliver Gugger
0e279eb15a
multi: refactor external subserver config
As a preparation for making more and more implementation details
configurable, we add a new ImplementationCfg struct that houses all the
interfaces that can be defined externally.
2021-10-08 12:08:23 +02:00
Oliver Gugger
140d5a8086
chainreg+lnd: split chain control initialization
As a preparation for extracting the wallet related initialization code,
we first need to separate the purely configuration related chain control
initialization from the wallet related code. We do that by splitting the
chain control into a partial and full struct that is initialized in two
parts. This also allows us to create the wallet configuration itself
outside of the chain control package and we need to thread through fewer
parameters through the chain control config.
2021-10-08 12:06:54 +02:00
Oliver Gugger
47f1b81a51
walletunlocker+lnd: move WalletUnlockParams
As a preparation for adding the wallet unlock params to the chain
control, we first need to move them out of the main package.
2021-10-08 12:06:54 +02:00
Oliver Gugger
862f712394
lnd+pilot: use minHTLCIn instead of whole config
To remove one more direct dependency to a variable in our main function,
we pass in the required parameter to the autopilot only instead of the
whole chain configuration.
2021-10-08 12:06:54 +02:00