New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
watchtower pkg #2448
watchtower pkg #2448
Conversation
6541aae
to
9957ed3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stoked to see the final server start to come together! Did an initial pass and things are looking pretty good to me, should be able to land soon after another pass.
watchtower/watchtower.go
Outdated
"github.com/lightningnetwork/lnd/watchtower/wtserver" | ||
) | ||
|
||
// Watchtower encapsulates the server-side functionality required by watchtower |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
watchtower.Watchtower
🙃
The redundancy...Server
perhaps? Not a blocking comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a stab and went with Standalone
, since it really couples a server and the breach monitoring services in one unit. In the future we could add the split implementations to this package, e.g. watchtower.Endpoint
and watchtower.Monitor
or something along those lines. Let me know what you think
7ec50be
to
11049b0
Compare
Comments addressed, @Roasbeef PTAL |
11049b0
to
b32afd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💎
In this PR, we introduce the
watchtower
package used to configure and run a watchtower. The top levelwatchtower.Standalone
struct couples thelookout
andwtserver
subsystems, enabling the full server-side protocol and breach monitoring. It also initializes the WTWR subsystem logger, which will be inherited by both the lookout and wtserver packages.In order to facilitate the package's use as an extension to LND or a standalone daemon, the
watchtower.Config
provides a common interface for all of the towers resources and configurable parameters. These resources are then passed down to the appropriate subsystems so that they can faithfully perform their duties. Some of these options are to be configured from the command line, which leads us to:Considerations for CLI Configuration
As these parameters begin to be exposed as CLI flags or config file options, we introduce the
watchtower.Conf
which exports the configurable parameters. This struct is meant to be embedded into a higher-level config struct and can be grouped according to the applications needs.For example, LND will use a small sub-config with an
Active
flag and be grouped under a "watchtower" prefix. If the watchtower is to run in a standalone daemon, thewatchtower.Conf
can be embedded directly into the primary config, as it is already assumed that the tower is to be active. As more parameters are exposed, this will provide a common interface to users of the package.Assuming all other resources have been provided to a
watchtower.Config
, any parameters parsed into awatchtower.Conf
can then be applied to aConfig
to generate the final config that should be passed towatchtower.New
. If no CLI configuration is necessary, users of the package can set the values in theirwatchtower.Config
direclty.Note: This PR does not expose the watchtower configuration options in LND's config, it only adds the struct that will later be embedded. Further, the configuration options are only available in experimental builds as there are few moving parts of the protocol that should be solidified before attempting to operate a tower.