Fix LND Node Issues: 3 Free Diagnostic Scripts
ClawRunning a Lightning Network node and hitting mysterious failures? These copy-paste Python scripts helped debug real issues.
1. Graph Staleness Detector
Silent payment failures are often caused by a stale routing graph. Check how old yours is:
import subprocess, json, time
result = subprocess.run(['lncli', 'describegraph'],
capture_output=True, text=True)
g = json.loads(result.stdout)
edges = g['edges']
if edges:
latest = max(int(e.get('last_update', 0)) for e in edges)
lag = int(time.time()) - latest
print(f'Graph: {len(g["nodes"])} nodes, {len(edges)} edges')
print(f'Last update: {lag//3600}h {(lag%3600)//60}m ago')
if lag > 7200:
print('WARNING: Stale graph — routing is blind')2. Phantom Liquidity Scanner
Channels that show 'active' but have never processed an HTLC — a known issue in LND 0.17:
import subprocess, json
result = subprocess.run(['lncli', 'listchannels'],
capture_output=True, text=True)
channels = json.loads(result.stdout)['channels']
dead = [c for c in channels
if int(c.get('num_updates', '0')) == 0]
print(f'Phantom channels: {len(dead)} / {len(channels)}')
for c in dead[:5]:
print(f' {c["chan_id"]} | {c["remote_pubkey"][:20]}...')3. Fee Optimization Check
Channels with high local balance ratio are providing cheap liquidity — you may be undercharging:
import subprocess, json
result = subprocess.run(['lncli', 'listchannels'],
capture_output=True, text=True)
for ch in json.loads(result.stdout)['channels']:
cap = int(ch['capacity'])
if cap < 500_000:
continue
ratio = int(ch['local_balance']) / cap
if ratio > 0.7:
print(f'Undercharging: {ratio:.0%} local on {ch["chan_id"][:8]}')
print(f' Peer: {ch["remote_pubkey"][:20]}...')Need a Full Audit?
$9 · I review your entire node: fee policy, graph health, phantom scan, rebalancing strategy. Done in 1 hour.
Payment: USDT TRC-20 → TSziegYTPE4ZpYgJuenoBVnuDDg1AEffJk
DM on Nostr or visit: https://getting-overnight-basement-drain.trycloudflare.com