lnd grpc api remains in undefined state on given invalid macaroon path
- Dominant language
- Python
- Stars
- 25
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
When LND is started with an invalid macaroon path the lightning parts will be in an undefined state. The algorithm should test the paths existence for some time and stop if unsuccessful after x amount of tries. If the Api is started at the same time as with the lightning node the required files might not be available yet.
```
2023-07-09 07:01:17 | ❌ | events.py:80 | An error has been caught in function '_run', process 'MainProcess' (1), thread 'MainThread' (140323440888704):
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 8, in
sys.exit(main())
│ │ └
│ └
└
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └
└
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
│ │ └
│ └
└
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ │ │ │ └ {'host': '0.0.0.0', 'port': 80, 'app': 'app.main:app', 'uds': None, 'fd': None, 'reload': False, 'reload_dirs': (), 'reload_i...
│ │ │ │ └
│ │ │ └
│ │ └
│ └
└
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
│ └ {'host': '0.0.0.0', 'port': 80, 'app': 'app.main:app', 'uds': None, 'fd': None, 'reload': False, 'reload_dirs': (), 'reload_i...
└ ()
File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 404, in main
run(
└
File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 569, in run
server.run()
│ └
└
File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └
│ │ └
│ └
└
File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
│ │ └
│ └
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 634, in run_until_complete
self.run_forever()
│ └
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
self._run_once()
│ └
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1905, in _run_once
handle._run()
│ └
└ ()>
> File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └
│ │ │ │ └ ()>
│ │ │ └
│ │ └ ()>
│ └
└ ()>
File "/code/./app/main.py", line 152, in _initialize_lightning
async for u in initialize_ln_repo():
└
File "/code/./app/lightning/service.py", line 72, in initialize_ln_repo
async for u in ln.initialize():
│ └
└
File "/code/./app/lightning/impl/lnd_grpc.py", line 214, in initialize
lnd_macaroon = config_get_hex_str(dconfig("lnd_macaroon"), name="lnd_macaroon")
│ └
└
File "/code/./app/api/utils.py", line 189, in config_get_hex_str
raise ValueError(f"{name} is not a valid path")
ValueError: lnd_macaroon is not a valid path
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in app/lightning/impl/lnd_grpc.py at initialize(), then inspect app/api/utils.py where lnd_macaroon paths are validated and app/main.py where lightning initialization runs. Define the retry and stopping behavior for a temporarily unavailable macaroon path, and verify initialization no longer leaves the lightning components undefined when the path remains invalid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100