blitz_api/app
fusion44 1081b7161a
fix(lightning): get_ln_info returns stub in bitcoin-only mode
`ln` is only bound to LnNode() when `BAPI_LN_NODE != "none"`. Every
`await ln.X()` call in this file therefore NameErrors when the
operator runs in bitcoin-only mode.

The most-hit caller is NativePythonSystem.get_system_info() at
app/system/impl/native_python.py:32, which always reads
`lninfo.alias` and `lninfo.color` to populate SystemInfo. The
NameError there breaks the SSE warmup pipeline
(get_full_client_warmup_data_bitcoinonly in app/api/warmup.py:116):

  warmup_new_connections() — calls get_full_client_warmup_data_bitcoinonly()
  → get_system_info() (via NativePythonSystem)
  → get_ln_info()
  → NameError: name 'ln' is not defined

The exception bubbles into the asyncio.gather(), which means new
SSE subscribers in bitcoin-only mode never receive `btc_info` /
`system_info` / `installed_app_status`. Their dashboards stay empty
forever (only periodic `hardware_info` and `ping` events flow,
because those run on separate gather loops).

Two fixes in this commit:

1. Return a stub LnInfo from get_ln_info() when ln_node == "none".
   All required fields filled with empty strings / zeros; the stub
   round-trips through any caller that reads alias/color/num_*
   without error. Other ln-method callers (get_wallet_balance,
   list_invoices, ...) keep their original behavior — they'll only
   ever fire from LN-aware code paths anyway.

2. Drop the duplicate `if ln_node != "none": ln = LnNode()` block
   at lines 69-70 (clearly a merge artifact).

Operator workaround used until this lands: enable lnd. After this
fix, bitcoin-only mode works end-to-end against the nixblitz
plugin streamer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 19:18:39 +02:00
..
api chore: clean up imports; add better LND error logging 2026-02-03 11:05:19 +01:00
apps chore: clean up imports; add better LND error logging 2026-02-03 11:05:19 +01:00
auth feat: make config loading more flexible 2025-03-23 17:43:39 +01:00
bitcoind chore: small fixes and updates 2025-05-06 09:16:46 +02:00
external feat: update Python and Devenv deps 2026-02-03 11:04:41 +01:00
lightning fix(lightning): get_ln_info returns stub in bitcoin-only mode 2026-05-07 19:18:39 +02:00
setup feat: replace call_script func with better func 2025-05-06 09:16:46 +02:00
system feat: update Python and Devenv deps 2026-02-03 11:04:41 +01:00
__init__.py feat: prepare for release 0.5.1beta 2023-02-05 21:24:31 +01:00
celery_app.py feat: fetch app status via a celery task 2025-05-06 09:16:46 +02:00
logging.py feat: make config loading more flexible 2025-03-23 17:43:39 +01:00
main.py feat: update Python and Devenv deps 2026-02-03 11:04:41 +01:00
server.py chore: small fixes and updates 2025-05-06 09:16:46 +02:00