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

lnd: generate default macaroons independently #7592

Merged

Conversation

sangaman
Copy link
Contributor

Change Description

This modifies the genMacaroons logic to indepently check for each of the three default macaroons (admin, readonly, invoice) and generate whichever are missing. Previously, this was an all or nothing routine. In other words, either all three didn't exist on disk and all three are created, or no macaroons are created. Although that works for the first run of a new node, it can result in inconsistent states if only one or two of the macaroons is deleted.

See #7566.

Steps to Test

  1. Start fresh lnd node and create a wallet.
  2. Observer that default macaroons including admin.macaroon are created.
  3. Delete admin.macaroon.
  4. Restart lnd node.
  5. Observe that admin.macaroon has been recreated.

@sangaman sangaman force-pushed the gen-default-macaroons-independently branch 2 times, most recently from 8c3e421 to 589fb8b Compare April 11, 2023 18:00
@guggero guggero self-requested a review April 11, 2023 20:05
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Very nice addition, will definitely be useful to many users.

lnd.go Outdated Show resolved Hide resolved
lnd.go Outdated Show resolved Hide resolved
lnd.go Show resolved Hide resolved
lnd.go Outdated Show resolved Hide resolved
lnd.go Outdated Show resolved Hide resolved
@sangaman sangaman force-pushed the gen-default-macaroons-independently branch from 589fb8b to c3c67a9 Compare April 12, 2023 13:36
@sangaman
Copy link
Contributor Author

Thanks @guggero! I believe I've addressed all your feedback.

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

tACK, LGTM 🎉

lnd.go Outdated Show resolved Hide resolved
@guggero guggero requested a review from sputn1ck April 12, 2023 15:32
@sangaman sangaman force-pushed the gen-default-macaroons-independently branch from c3c67a9 to ab7a3f4 Compare April 12, 2023 17:36
Copy link
Collaborator

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

tACK & LGTM! 🔥 thanks for this!

lnd.go Show resolved Hide resolved
@lightninglabs-deploy
Copy link

@sputn1ck: review reminder

@ellemouton
Copy link
Collaborator

@sangaman - this juuuust missed the 0.16.1 cutoff :( can you more the release note to the 0.17.0 doc please?

Copy link
Collaborator

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

tACK! 🚀

This modifies the `genMacaroons` logic to indepently check for each of
the three default macaroons (admin, readonly, invoice) and generate
whichever are missing. Previously, this was an all or nothing routine.
In other words, either all three didn't exist on disk and all three are
created, or no macaroons are created. Although that works for the first
run of a new node, it can result in inconsistent states if only one or
two of the macaroons is deleted.

See lightningnetwork#7566.
@sangaman sangaman force-pushed the gen-default-macaroons-independently branch from ab7a3f4 to 16463d4 Compare April 26, 2023 17:31
@sangaman
Copy link
Contributor Author

I moved the release note from 0.16.1 to 0.17.0.

@guggero guggero merged commit 7854b73 into lightningnetwork:master Apr 27, 2023
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.

5 participants