Commit Graph

387 Commits

Author SHA1 Message Date
0aea482b51 multi: add testnet4 support 2025-03-24 11:53:23 -05:00
8862ce99d5 lnd: use errors.Is for error comparison 2024-12-02 09:23:07 +02:00
ed4279b6f3 lnd: update Main logs to use structured logging 2024-12-02 09:23:07 +02:00
32fbea2f85 lnd: use structured logs in mkErr helper 2024-12-02 09:23:06 +02:00
755ad49440 build: Append commit hash to the main LND context
It can be disabled via the new `logging.no-commit-hash` config option.
2024-12-02 09:23:06 +02:00
a04f8dfd4f lnd: pass ctx to rest proxy 2024-12-02 09:23:06 +02:00
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
448193b0fd multi: separate profiler config 2024-10-18 13:03:30 +02:00
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
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
b45d72fe59 multi: thread thru the AuxLeafStore everywhere 2024-08-28 13:26:14 +02:00
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
4a3c4e4ba7 Merge pull request #8497 from ziggie1984/shutdown-bugfix
routing: shutdown chanrouter correctly.
2024-08-01 16:48:50 -07:00
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
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
ab83343c87 multi: repleace ioutil.ReadFile 2024-04-25 11:22:43 +02:00
648fb22f63 multi: wrap all errors 2024-04-11 15:04:03 +02:00
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
039e9effe7 lnd: add http header timeout to config 2023-10-11 22:05:50 -06:00
031dbd7760 multi: remove ChainRegistry 2023-10-06 16:34:47 -07:00
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
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
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
148732af61 lnd: fix pprof server redirects 2023-06-22 01:23:27 +08:00
bd205aac13 lnd: add debug log when syncing blocks 2023-06-19 14:53:56 +08:00
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
f9436ec05d mod+cmd/lncli: use google.golang.org/protobuf package 2023-05-11 22:51:16 +02:00
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
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
c0f44a17b7 lnd: Add ability to encrypt TLS key on disk 2023-01-26 13:32:11 -06:00
60be9085c3 lnd: Move TlsManager files to new files 2023-01-26 13:32:11 -06:00
7e03297b1b lnd: refactor getTLSConfig 2023-01-26 13:32:11 -06:00
c89dd86a2e fix typo 2022-10-27 16:26:47 -07:00
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
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
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
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
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
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
895a2e497b multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
dfdc2bff8b multi: run gosimports 2022-02-10 11:02:01 +01:00
62dc1b5323 multi: Update Licenses to 2022 [skip ci] 2022-02-09 00:25:20 +02:00
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
eeea141e01 lnd: allow large GRPC messages 2022-01-24 17:43:00 +01:00
530a2059e5 multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
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
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
87c5b76e4d lnd: simplify listener creation 2021-11-05 10:49:37 +01:00
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
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