Commit graph

32 commits

Author SHA1 Message Date
bitromortac
dccbf53a17
chanevents: add channel event pruning
We add regular channel event pruning, as otherwise the database may get
filled quickly. We add two mechanisms, a retention time and a max events
number. Both can be turned on individually.
2026-06-25 13:53:26 +02:00
bitromortac
e13c5bda9b frdrpcserver: implement ForwardingAbility RPC handler 2026-06-11 12:40:32 +02:00
bitromortac
44bb23186a faraday+frdrpcserver: pass in chan events store
Threads the chanevents.Store the daemon already constructs into the
frdrpcserver.Config so the upcoming GetChannelEvents handler has a
read path. Both standalone and subserver startup wire the same store
instance.
2026-05-08 20:13:58 +02:00
bitromortac
f3a3de9ac4
faraday: start chan events monitor 2026-04-08 15:13:24 +02:00
bitromortac
188163c8dd
faraday: initialize stores 2026-04-02 12:25:36 +02:00
bitromortac
875ea740e6
faraday: introduce structured lifecycle for the Faraday daemon
Refine the Faraday struct's lifecycle management:

- Use atomic.Bool for cleaner start/stop guards with CompareAndSwap
  instead of the old atomic.AddInt32 pattern.
- Extract initialize() to consolidate macaroon and bitcoin client setup
  shared between Start() and StartAsSubserver().
- Extract startRPCServer()/stopRPCServer() from the monolithic
  Start()/Stop() methods for better separation of concerns.
- Use the lndOwned flag so Stop() only closes the lnd connection in
  standalone mode, leaving it open for the parent in subserver mode.
- Move lnd connection and bitcoin client creation from Main() into the
  Faraday struct so callers only need New() and Start().
- Mark the struct as permanently stopped on Start failure to prevent
  retry with stale internal state. Guard startRPCServer against a nil
  macaroon service.
- Reorder Stop() to wait for in-flight RPC goroutines before tearing
  down the macaroon service.
2026-03-24 10:02:35 +01:00
bitromortac
d98e8ef59e
faraday+frdrpcserver: move server infrastructure to faraday package
Move the gRPC/REST server lifecycle, macaroon service management, and
TLS setup from frdrpcserver.RPCServer to a new Faraday struct in the
faraday package. This leaves RPCServer as a pure RPC request handler
with only business logic methods.

The Faraday struct embeds *frdrpcserver.RPCServer and takes ownership
of all infrastructure concerns: gRPC/REST server creation, macaroon
service setup, TLS configuration, and start/stop lifecycle. The
frdrpcserver.Config is slimmed down to just Lnd and BitcoinClient.

The macaroons.go file is also moved from frdrpcserver to the faraday
package, as the macaroon constants are now used by the Faraday struct
directly.
2026-03-24 09:43:39 +01:00
Elle Mouton
617c793ec3
multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
Oliver Gugger
bb8671250f
config+faraday: allow lnd request timeout to be configured 2024-01-29 10:15:27 +02:00
Oliver Gugger
71bb06f6f7
multi: fix linter issues, run imports 2022-11-21 17:12:17 +01:00
Oliver Gugger
b2ce30b3c8
faraday: bump lnd min version to v0.15.4-beta 2022-11-21 16:28:32 +01:00
Oliver Gugger
6f4c01d0f6
frdrpc+frdrpcserver: move RPC server into own package
To avoid the frdrpc package having dependencies to other libraries and
making using the JSON/WASM stubs hard, we extract all the business logic
and RPC server code into its own package called frdrpcserver.
2022-05-02 12:24:44 +02:00
carla
5180779806
multi: bump lndclient version 2021-09-14 08:49:48 +02:00
Oliver Gugger
a51f229830
multi: move ParseAndSetDebugLevels out of ValidateConfig
We need to move the call that sets all log levels out of the config
validation. Otherwise this will overwrite all subsystem log levels in
LiT where we call the faraday.ValidateConfig() function but have already
set up our loggers.

At the same time we remove the unnecessary global logWriter variable.
2021-05-31 13:57:45 +02:00
Oliver Gugger
4f63e3e1ab
multi: allow only readonly.macaroon to be used
Fixes #84.
Allows faraday to only use the readonly.macaroon (or a custom baked one)
to connect to lnd instead of needing to copy all macaroons (including
the subserver ones).
2021-05-31 13:57:08 +02:00
Oliver Gugger
cc65c46077
mod+frdrpc: bump lnd version to v0.13.0-beta.rc2 2021-05-17 13:16:21 +02:00
Oliver Gugger
9f62b53790
faraday+frdrpc: add macaroon auth to faraday's server conn
To secure access to faraday's RPC server, we add a macaroon
authentication service and its gRPC interceptors to the daemon's server
connection.
2020-09-11 15:10:51 +02:00
Oliver Gugger
02de78a1a9
config+faraday: extract ValidateConfig
To make it easier to use faraday as an external subserver, it is
necessary to extract the config validation into its own function that is
separate from loading the config.
2020-09-11 12:33:25 +02:00
Oliver Gugger
4e0ffc1382
mod+faraday: update to lnd 0.11.1
We update to the newest verion of lnd so we can use the updated macaroon
service.
NOTE: This is a compile time dependency update only, no RPC level update
is required.
2020-09-11 12:30:57 +02:00
carla
2be7115ebe
multi: standardize import order 2020-09-09 10:07:14 +02:00
Oliver Gugger
853623e5e4
multi: add TLS config to RPC server
As a preparation to start the gRPC server using TLS, we make sure the
certificate is created and loaded correctly before starting the server
itself.
We also need to silence the linter that complains about the struct
alignment because we didn't put all boolean variables to the beginning.
But since this struct will only be loaded once per process we care more
about similar options being grouped than memory efficiency.
2020-09-08 20:09:30 +02:00
Oliver Gugger
74b7af0d6b
config: use just one network flag
To make the command line interface a bit more similar to other tools
like loop, we switch from using single flags like --testnet or --regtest
to just one --network flag.
2020-09-08 19:48:24 +02:00
Oliver Gugger
a7166ad836
config: move lnd parameter into sub struct
As a preparation to add TLS to faraday itself, we need to move the
parameters that are meant for lnd into its own sub struct to avoid name
collisions and user confusion.
2020-09-08 19:48:23 +02:00
carla
dc3dd515b1
accounting: add pending channels to on chain report
Previously, if we generated a report while a channel was pending open
or close, it would not have been picked up as a channel. This change
adds pending channels and simplifies our on chain sorting to just have
opened and closed channels (independent of the source where we got the
channel information).
2020-08-12 11:14:49 +02:00
carla
bb0b82aaee
multi: optionally connect faraday to a bitcoin node
Original chain code copied from:
e3c34449484d7dc8d505a98ea275e510651d7c3d

Co-authored-by: Oliver Gugger gugger@gmail.com
2020-06-27 14:47:20 +02:00
carla
ae0e901c27
multi: point to new lndclient repo 2020-06-18 16:45:59 +02:00
carla
03077bcae3
multi: connect faraday to lnd services rather than lnd client
We are going to need the walletkit and chainnotifier subservers in
future changes, so we make the switch now. Note that this commit does
not build, and is split up for the sake of easy review.
2020-06-17 09:42:55 +02:00
Oliver Gugger
0d3293f2c0
faraday: intercept shutdown signals 2020-05-14 15:39:58 +02:00
Oliver Gugger
a09f5edfec
faraday+config: expose LoadConfig and DefaultConfig 2020-05-14 14:59:16 +02:00
Oliver Gugger
95aa5d72b9
mod+rpcserver: add REST proxy 2020-04-07 11:13:10 +02:00
carla
00a052749b
multi: rename loggers 2020-03-30 09:26:01 +02:00
carla
df836c2d21
multi: faraday rename 2020-03-30 09:25:46 +02:00
Renamed from governator.go (Browse further)