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.
Set the `faradayDirSet` boolean before namespacing the directory with
the network. This fixes a bug where the user would _not_ set faradayDir
but would set the macaroon path and would run into the "faradaydir
overwrites macaroonpath..." error.
Since the code for creating and using a macaroon service is the same for
multiple projects (pool, loop, faraday & litd), the code has been
unified in lndclient. So this commit removes the macaroon service code
and instead uses the lndclient code.
Since the default key for the macaroon db is now a shared secret with
LND, faraday requires LND's admin macaroon so that this secret can be
derived. So this commit also updates all references of LND's `readme`
macaroon to the `admin` macaroon.
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.
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).
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.
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.
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.
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.
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.
This commit adds code to connect to LND's RPC from the
terminator main function. It allows users to specify
config through command line flags, and validates the
input where possible.