Open Kixunil opened 4 years ago
LND generates macaroons as soon as its initialized. Your implementation uses a non-standard folder location for the macaroon files. Please ensure that as soon as LND initializes, the macaroon files are copied to the location which you have provided in the RTL config settings.
RTL needs the macaroon to communicate with all the LND APIs, including the init wallet operation.
Closing this ticket for now. Feel free to re-open if the macaroon exists and RTL is still unable to read the file.
Non-default paths have nothing to do with it as I set them up properly in LND config, using appropriate options, so they have to be generated at those places. I also checked the LND logs for any kinds of error messages related to generating macaroons - there were none. I also tried to remove custom path configurations to see if default one generates macaroons. It didn't.
Since I was struggling to get the macaroons generated by LND, I looked at the actual code and it's doing exactly what I said in my previous comment, see:
Because of how the code is written it's impossible for macaroons to exist when the wallet is not initialized yet. So the bug must be at RTL.
That being said, I don't deny that this kind of workflow by LND is very weird, so I'm not surprised bugs like this one pop up.
I wanted to be absolutely sure, so I decided to check what lncli
does. And indeed, it specifically skips macaroons in wallet unlocker you can see that true
argument means skipMacaroons
at getClientConn
and see the argument used to skip reading the files.
Reopening this to investigate further.
It is being tracked with #367 & #369. Closing this issue.
Why? Those two bugs aren't related. This one is about using RTL to initialize the wallet, #367 is about frontend, #369 is about configuration.
I thought it was resolved after fixing the lnServerUrl. Reopening the issue and assigning it to @saubyk
@Kixunil I failed to reproduce the issue with the two different scenarios, below. Either the wallet is initialized or RTL is showing appropriate error on the UI.
Environment:
Scenario 1 1) Create fresh LND instance:
lnd
Scenario 2
1) Create Lnd Folder only, but lnd
server NOT initialized:
ECONNREFUSED
error because lnd
server is not available.
5) RTL shows the error on the screen.
including admin.macaroon
What? That's impossible, the wallet password is required for generating macaroons (because it needs to unlock the macaroon storage)
Did you use noseedbackup
? Could you please post your whole LND config and the command line?
My command line: /usr/bin/lnd -C /etc/lnd-system-regtest/lnd.conf
All required directories were created prior to launching lnd
The same with mainnet (just replace all instances of regtest
with mainnnet
and adjust the ports)
And command line: lnd
Another observation: Your LND config is listning to REST on port 9092 and your RTL config's lnServerUrl is pointing to port 9090.
That's super weird, I'm unable to understand how it's possible, so I opened an issue at LND.
Those ports are not a problem as before I posted configuration from mainnet and later from regtest, both behave the same in my case.
LND generates macaroons as soon as its initialized. Your implementation uses a non-standard folder location for the macaroon files. Please ensure that as soon as LND initializes, the macaroon files are copied to the location which you have provided in the RTL config settings.
RTL needs the macaroon to communicate with all the LND APIs, including the init wallet operation.
As commented in https://github.com/lightningnetwork/lnd/issues/4498, this is not true. The calls to the WalletUnlocker
service (now with v0.11.0-beta.rc1
located in a separate file walletunlocker.proto
) do not require a macaroon to be sent.
A macaroon was never required for these calls and will never be required because, as @Kixunil pointed out, they aren't generated until after unlocking the wallet.
@guggero thanks for confirming! How @ShahanaFarooqui got the macaroon generated then? The config doesn't contain noseedbackup
and the directory was freshly created. :thinking:
@guggero I wanted to create a small gif to show above behavior (admin.macaroon generates without --noseedbackup setting) but after computer restart I am unable to reproduce it. So, thanks for now. I will open an issue if i will be able to reproduce it ever again.
@Kixunil This time, Scenario 1 worked like below: 1) Create fresh LND instance:
lnd
Describe the bug
Important: to my knowledge LND doesn't produce macaroons until it's initialized - that's why I believe this is a bug with RTL, not my config.
When attempting to initialize a completely fresh LND, which didn't create macaroons yet, I get this error:
My configuration:
To Reproduce Steps to reproduce the behavior:
sudo journalctl -u $rtl_service_name
reports the error aboveScreenshots If applicable, add screenshots to help explain your problem.
Your environment
RTL
0.7.0lnd
0.9.2btcd
,bitcoind
, or other backend 0.19.1uname -a
on *Nix) Linux disp6398 4.19.107-1.pvops.qubes.x86_64 #1 SMP Sat Feb 29 16:04:42 UTC 2020 x86_64 GNU/Linux