Title: [Bug] Stale HTLC data in closed channels causing TypeError (Pandas Series) in Channel View
Context:
Running LNDg v1.11.0 on PostgreSQL with Django 6.0.3 / Python 3.12.
Observation:
I'm seeing a Server Error (500) on specific channel pages. Specifically, when a peer has multiple channel records in gui_channels (e.g., one active, one or more closed), and the closed records haven't zeroed out their HTLC stats.
The Error:
TypeError at /channel
int() argument must be a string, a bytes-like object or a real number, not 'Series'
Exception Location: /home/hakuna/lndg/gui/views.py, line 1000, in channel
Traceback:
Environment:
Request Method: GET
Request URL: https://lndg.hodlmetight.org/channel?=1015825598867636232
Django Version: 6.0.3
Python Version: 3.12.3
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.humanize',
'gui',
'rest_framework',
'django_filters']
Installed Middleware:
['whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/home/hakuna/lndg/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/home/hakuna/lndg/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 198, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hakuna/lndg/.venv/lib/python3.12/site-packages/django/contrib/auth/decorators.py", line 59, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hakuna/lndg/gui/views.py", line 1000, in channel
channels_df['out_rate'] = int((channels_df['revenue_7day_fees']/channels_df['amt_routed_out_7day_fees'])*1000000) if channels_df['amt_routed_out_7day_fees'][0] > 0 else 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: TypeError at /channel
Exception Value: int() argument must be a string, a bytes-like object or a real number, not 'Series'
Hypothesis:
In gui/views.py, there’s logic using Pandas to aggregate channel or rebalance data. Because I have multiple records for the same peer/pubkey in Postgres, the grouping returns a Pandas Series instead of a single scalar value. When the code tries to cast this result to int(), it crashes.
Supporting Data:
A query on gui_channels for a single peer (Edelweiss🏔️) returns multiple records where a closed channel (is_open: f) still has an htlc_count and pending_outbound balance:
| chan_id |
is_open |
htlc_count |
pending_outbound |
| 1015825598867636232 (Active) |
t |
1 |
201477 |
| 947028056710840326 (Closed) |
f |
1 |
24525 |
Controller Symptoms:
The lndg-controller.log also spams:
Could not find peer [pubkey] with expiring HTLC: [hash]
This suggests the controller loop is iterating over all channels with htlc_count > 0, including the stale/closed ones, but then fails to resolve the peer logic correctly for the dead channel.
Suggested Fix:
- Ensure
htlc_count and pending balances are hard-zeroed when a channel is marked is_open = f.
- Update the Pandas logic in
gui/views.py (around line 1000) to handle potential multi-record returns (e.g., using .iloc[0] or .sum()) to avoid the TypeError.
Title: [Bug] Stale HTLC data in closed channels causing TypeError (Pandas Series) in Channel View
Context:
Running LNDg v1.11.0 on PostgreSQL with Django 6.0.3 / Python 3.12.
Observation:
I'm seeing a Server Error (500) on specific channel pages. Specifically, when a peer has multiple channel records in
gui_channels(e.g., one active, one or more closed), and the closed records haven't zeroed out their HTLC stats.The Error:
Traceback:
Hypothesis:
In
gui/views.py, there’s logic using Pandas to aggregate channel or rebalance data. Because I have multiple records for the same peer/pubkey in Postgres, the grouping returns a Pandas Series instead of a single scalar value. When the code tries to cast this result toint(), it crashes.Supporting Data:
A query on
gui_channelsfor a single peer (Edelweiss🏔️) returns multiple records where a closed channel (is_open: f) still has anhtlc_countandpending_outboundbalance:Controller Symptoms:
The
lndg-controller.logalso spams:Could not find peer [pubkey] with expiring HTLC: [hash]This suggests the controller loop is iterating over all channels with
htlc_count > 0, including the stale/closed ones, but then fails to resolve the peer logic correctly for the dead channel.Suggested Fix:
htlc_countandpendingbalances are hard-zeroed when a channel is markedis_open = f.gui/views.py(around line 1000) to handle potential multi-record returns (e.g., using.iloc[0]or.sum()) to avoid theTypeError.