lightninglabs / lightning-terminal

Lightning Terminal: Your Home for Lightning Liquidity
MIT License
487 stars 82 forks source link

Integrated mode unable to start when LND is behind Tor #627

Open ApacheSub opened 10 months ago

ApacheSub commented 10 months ago

I have been fighting an issue with litd when LND is behind Tor. I think there should be a warning about running litd when LND is behind Tor due to the following error crashing litd (and LND):

LITD: Error starting Lightning Terminal: could not start subservers: unable to start pool in integrated mode: rpc error: code = DeadlineExceeded desc = context deadline exceeded.

This happens because GetInfo is not quick enough. This causes sub servers not being able to start and shutting down LND alongside litd.

Users should be warned about this because I was indeed once able to start litd by some miracle. I then added some funds to Pool and had to restart LND but after this I was unable to start litd anymore. This made me feel like my funds were lost. I could, of course, opt to start litd without Tor but it's infeasible in my setup.

This might be a related issue: https://github.com/lightninglabs/loop/issues/322

The fact seems to be that Tor adds too much latency and GetInfo does not respond as quickly as is expected. It seems a bit silly that the deadline is so short.

I have determined that the issue does indeed not appear when litd is started up in remote mode. GetInfo is always very slow right after LND has been started. It is faster after that. If I let LND start up in peace and then start litd, it does not seem to crash. Perhaps this issue could be avoided somehow with this in mind.

ellemouton commented 10 months ago

Hi @ApacheSub, thanks for the issue 🙏

Perhaps a good idea to open a PR on the Pool repo to make the getInfoTimeout (5 seconds) configurable instead.

unable to start pool in integrated mode

Worth noting that once this PR has landed, then failure of one subsystem (like pool) starting, wont prevent the rest of Litd starting 👍