Skip to content
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

wtclient: automatically initialise while creating a watchtower server #5596

Closed

Conversation

DarthBenro008
Copy link

Initially, the --wtclient.active had to be passed alongside --watchtower.active for lncli to be able to connect to the watchtower

This PR inverts the functionality, now wtclient is automatically created, however if you do not want it it to create automatically, you can pass --watchtower.deactivate now instead.

Old Command:
lnd --watchtower.active --wtclient.activate

New Command (automatically creates a wtclient):
lnd --watchtower.active

New Command to disable creating wtclient:
lnd --watchtower.active --wtclient.deactivate

[Test]: personally tested on local machine and passes go test .../..

Pull Request Checklist

  • All changes are Go version 1.15 compliant
  • Your PR passes all CI checks. If a check cannot be passed for a justifiable reason, that reason must be stated in the commit message and PR description.
  • If this is your first time contributing, we recommend you read the Code Contribution Guidelines
  • For new code: Code is accompanied by tests which exercise both the positive and negative (error paths) conditions (if applicable)
  • For bug fixes: If possible, code is accompanied by new tests which trigger the bug being fixed to prevent regressions
  • Any new logging statements use an appropriate subsystem and logging level
  • For code and documentation: lines are wrapped at 80 characters (the tab character should be counted as 8 characters, not 4, as some IDEs do per default)

@carlaKC carlaKC self-requested a review August 3, 2021 06:36
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Ideally we find a way to address this without a breaking change to config.
What do you think about leaving the active flag as is + defaulting to true? We can then add a deactivate, as done in this PR, for people who'd like to turn it off.

Also noticed that the CI "every commit builds" and "sample config" checks failed on this one (likely need to add the deactivate flag to our sample config).

lnd.go Outdated Show resolved Hide resolved
lncfg/wtclient.go Show resolved Hide resolved
@DarthBenro008
Copy link
Author

Sure! Making active to default would definitely not break things and is the safest way to proceed. Can we add a deprecation notice and warn the user about that they do not need to pass it anymore and eventually clean it up in future versions (stable)? I will also look into the config file and resolve the conflicts!

@carlaKC
Copy link
Collaborator

carlaKC commented Aug 11, 2021

Can we add a deprecation notice and warn the user about that they do not need to pass it anymore and eventually clean it up in future versions

Yeah, was thinking exactly this :)

- This commit adds the command wtclient.deactivate inorder to facilitate for automatic creation of wtclient

Signed-off-by: DarthBenro008 <hkpdev008@gmail.com>
@DarthBenro008
Copy link
Author

Hi @carlaKC , sorry for the delay, apparently the codebase that handles the database for watchtower and wtclient had completely changed, hence the merge conflicts. I re-wrote the implementation and have force pushed the codebase.

  • I have left --wtclient.activate as it is and deprecated it
  • I have tested all the changes locally

Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to click submit on my review 🙈

Just some nits, will test this out in the meantime.

sample-lnd.conf Outdated Show resolved Hide resolved
lncfg/wtclient.go Show resolved Hide resolved
Initially, the `--wtclient.active` had to be passed alongside `--watchtower.active` for lncli to be able to connect to the watchtower
This commit inverts the functionality, now `wtclient` is automatically created, however if you do not want it it to create automatically, you can pass `--watchtower.deactivate` now instead.

Signed-off-by: DarthBenro008 <hkpdev008@gmail.com>
Copy link
Collaborator

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly there!

Needs rebase + a few comments about minimizing diff size and clearer instructions to end user re active flag being deprecated.

@@ -4,9 +4,9 @@ import "fmt"

// WtClient holds the configuration options for the daemon's watchtower client.
type WtClient struct {
// Active determines whether a watchtower client should be created to
// Deactivate determines whether a watchtower client should not be created to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than make this flag Deactivate, could you leave Active as in and then just add the deprecation warning here rather than moving the Active flag below? Makes the diff a bit clearer.

I think we could also update the description here that this will always be set to true by default, and is just here for the sake of backwards compatibility?

@@ -906,16 +906,20 @@ litecoin.node=ltcd

[wtclient]

; Activate Watchtower Client. To get more information or configure watchtowers
; Deactivate Watchtower Client. To get more information or configure watchtowers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here re change order, leave this as Activate and add Deactivate below.


// defaultWatchTowerClientStartup sets the watchTower client to start
// automatically along with lnd
defaultWatchTowerClientStartup = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultWatchTowerClientStartup -> deafultWtClientActive?

@lightninglabs-deploy
Copy link

@Crypt-iQ: review reminder
@DarthBenro008, remember to re-request review from reviewers when ready

@carlaKC
Copy link
Collaborator

carlaKC commented Jan 11, 2022

Closing due to inactivity

@carlaKC carlaKC closed this Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activate watchtower client by default
3 participants