lnd: generate default macaroons independently

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 https://github.com/lightningnetwork/lnd/discussions/7566.
This commit is contained in:
Daniel McNally committed 2023-04-26 13:30:03 -04:00
1 parent fdc1ae9d57
commit 16463d4bd4
3 files changed
+57 -37

No files matched your search

+7 -1
View File
@@ -13,8 +13,14 @@
the entire retribution struct. This reduces the amount of data that needs to
be held in memory.
## Misc
* [Generate default macaroons
independently](https://github.com/lightningnetwork/lnd/pull/7592) on wallet
unlock or create.
# Contributors (Alphabetical Order)
* Daniel McNally
* Elle Mouton
* Jordi Montes