Skip to content

multi: switch to lndclient and fail on errors#58

Merged
Roasbeef merged 2 commits intolightninglabs:masterfrom
carlaKC:57-prepwork
Nov 20, 2020
Merged

multi: switch to lndclient and fail on errors#58
Roasbeef merged 2 commits intolightninglabs:masterfrom
carlaKC:57-prepwork

Conversation

@carlaKC
Copy link
Copy Markdown
Contributor

@carlaKC carlaKC commented Nov 9, 2020

This PR does some prepwork for adding the output from the htlc subscription api to lndmon, as described in #57.
Since we will need access to routerrpc for SubscribeHtlcEvents, this PR takes the plunge and switches us over to the full lndclient services. Rather than require all macaroons for lndmon, this PR depends on lightninglabs/lndclient/pull/19, which allows us to specify a single macaroon for lndclient.

This PR also updates lndmon to restart on collector failure, rather than just log an error.

Copy link
Copy Markdown
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

Change reads well, also will be nice to have the system properly restart if any of the components go down. One thing I'm weary of is the lndclient dep, though maybe in practice this won't be an issue since we don't really frequently update this repo like some of our others.

"context"

"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightninglabs/lndclient"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, will switching over to using lndclient actually cause more issues than it solves? Main thing I'm weary of is the need to update lndclient to expose some new functionality, rather than just updating the lnd package commit, then immediately having access to the new features.

Copy link
Copy Markdown
Contributor Author

@carlaKC carlaKC Nov 16, 2020

Choose a reason for hiding this comment

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

I haven't found that using lndclient has been much of a blocker for loop/faraday, the lndclient PRs are pretty straightforward to review and I do think we get some degree of increasing returns when we add endpoints to lndclient because they're then available for other projects. We can do this change without a switchover ofc, so happy to remove it if you think it'll slow dev too much, but I think it's worth doing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok np, if y'all don't think it slows things down, then I'm ok with the switch.


// Logger for lndmon's main process.
Logger = backendLog.Logger("LNDMON")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

As they were never used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These loggers were only used to log errors when we couldn't query lnd, which is now replaced by bubbling the error up through errChan. I don't love deleting them, because we could potentially re-add them in future with different prefixes, which would be inconsistent for end users, but the linter is complaining. Could add some placeholder log for each collector so we don't need to delete?

@carlaKC
Copy link
Copy Markdown
Contributor Author

carlaKC commented Nov 16, 2020

@Roasbeef re-requesting just for a call on lndclient switch, haven't pushed changes.

@carlaKC carlaKC requested a review from Roasbeef November 16, 2020 07:20
Switch lndmon to use lndclient, providing the readonly macaroon as our
only macaroon, so that no changes to lndmon setup are required. This
switch also provides us with version checks, which we set to lnd v0.11,
since that is the minimum supported version after recent CVEs.
Update all of our collectors to shutdown on failure rather than
sliently log. This paired with restarting the lndmon container on exit
allows easier detection of persistenet issues, and simple restart when
lnd is unavailable temporarily.
@Roasbeef Roasbeef merged commit f1dd633 into lightninglabs:master Nov 20, 2020
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.

2 participants