AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 19 Bitcoin

LNGossip: put maintain_db on thread

Public commit record

What the developer wrote

Authored by f321x

68/100 · Adequate
LNGossip: put maintain_db on thread

I regularly see asyncio (debug) warnings that maintain_db
is blocking the event loop on my relatively fast laptop.

E.g. 3 warnings during a single session:
```
2.41 | I | channel_db.ChannelDB | Deleting 903 old policies
2.68 | I | channel_db.ChannelDB | Deleting 3954 orphaned channels
2.68 | W | asyncio | Executing <Task pending name='Task-22' coro=<LNGossip.maintain_db() running at /var/home/user/code/vibecoding_vm/electrum/electrum/lnworker.py:728> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/lib64/python3.14/asyncio/base_events.py:459> cb=[set.discard(), TaskGroup._on_done()] created at /var/home/user/code/vibecoding_vm/electrum/electrum/util.py:1756> took 0.335 seconds
...
242.71 | I | channel_db.ChannelDB | Deleting 151 old policies
243.69 | I | channel_db.ChannelDB | Deleting 11819 orphaned channels
243.69 | W | asyncio | Executing <Task pending name='Task-22' coro=<LNGossip.maintain_db() running at /var/home/user/code/vibecoding_vm/electrum/electrum/lnworker.py:728> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/lib64/python3.14/asyncio/base_events.py:459> cb=[set.discard(), TaskGroup._on_done()] created at /var/home/user/code/vibecoding_vm/electrum/electrum/util.py:1756> took 1.010 seconds
...
363.72 | I | channel_db.ChannelDB | Deleting 108 old policies
363.90 | I | channel_db.ChannelDB | Deleting 2922 orphaned channels
363.90 | W | asyncio | Executing <Task pending name='Task-22' coro=<LNGossip.maintain_db() running at /var/home/user/code/vibecoding_vm/electrum/electrum/lnworker.py:728> wait_for=<Future pending cb=[Task.task_wakeup()] created at /usr/lib64/python3.14/asyncio/base_events.py:459> cb=[set.discard(), TaskGroup._on_done()] created at /var/home/user/code/vibecoding_vm/electrum/electrum/util.py:1756> took 0.205 seconds
```
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit moves two database cleanup tasks in Electrum's Lightning Network gossip code onto a separate thread so they no longer freeze the main asyncio event loop. It is a performance and responsiveness fix, not a security patch. There is no indication it fixes a vulnerability or was triggered by a security report.

Recommended action

No security action required. Treat as a normal performance/responsiveness improvement. Reviewers may verify that thread-safety of ChannelDB state is preserved when prune operations run off the main event loop.

Security signals we found

01

No security-relevant signals in commit message or diff

02

Change addresses asyncio event-loop blocking, which can affect availability/responsiveness but is not an exploit primitive

03

No input validation, authentication, cryptography, or memory-safety changes

Risk score

Why this scored 19/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.