lightninglabs / lightning-terminal

Lightning Terminal: Your Home for Lightning Liquidity
MIT License
506 stars 90 forks source link

Rotating the LND Admin Macaroon causes Litd to enter a crash loop #549

Closed gkrizek closed 1 year ago

gkrizek commented 1 year ago

I have a litd instance that's running in integrated mode for LND, Loop, Pool, and Faraday. The wallet was initially created with Stateless Init. I wanted to rotate my LND admin.macaroon file so I ran:

lncli changepassword --stateless_init --new_mac_root_key

This worked just fine and created a new macaroon. However, after the admin macaroon was rotated, litd crashed with the following error:

...
2023-05-16 02:44:08.291 [ERR] RPCS: [/lnrpc.Lightning/GetInfo]: verification failed: signature mismatch after caveat verification
2023-05-16 02:44:08.316 [INF] LNDC: lnd is now fully synced to its chain backend
2023-05-16 02:44:08.316 [INF] LITD: Baking internal super macaroon
2023-05-16 02:44:08.317 [ERR] RPCS: [/lnrpc.Lightning/BakeMacaroon]: unable to decrypt
2023-05-16 02:44:08.317 [ERR] LITD: Could not start subservers: rpc error: code = Unknown desc = unable to decrypt
2023-05-16 02:44:08.317 [WRN] GRPC: [core] grpc: addrConn.createTransport failed to connect to {localhost:8443 localhost:8443 <nil> 0 <nil>}. Err: connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:8443: connect: connection refused". Reconnecting...
2023-05-16 02:44:08.318 [INF] SGNL: Received shutdown request.
2023-05-16 02:44:08.318 [INF] SGNL: Shutting down...
...

This continues every time I try to start up Litd now.

Expected behavior

I expect litd to be able to handle rotating the LND admin.macaroon file and not crash afterward

Actual behavior

After you rotate the LND admin macaroon, Litd will no longer start up.

To reproduce

1) Run litd in integrated mode 2) run lncli create --stateless_init 3) Rotate the admin macaroon with lncli changepassword --stateless_init --new_mac_root_key

ellemouton commented 1 year ago

thanks for reporting @gkrizek - gonna take a look at this first thing tomorrow

ellemouton commented 1 year ago

Hi @gkrizek :) an update:

the bug was on the LND side of things. So that has been fixed and merged now but will only be available in LiT after the next lnd release (which will hopefully be soon). In the mean time, completely deleting the macaroon.db should get you out of this crash loop

ellemouton commented 1 year ago

Fixed in https://github.com/lightninglabs/lightning-terminal/pull/566