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

Blink funding source: Reduce payment-status polling, add caching and backoff (#4042)

Public commit record

What the developer wrote

Authored by Nathan Day

81/100 · Strong
Blink funding source: Reduce payment-status polling, add caching and backoff (#4042)

Co-authored-by: dadofsambonzuki <dadofsambonzuki@noemail.com>
Co-authored-by: Arc <33088785+arcbtc@users.noreply.github.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit rewrites how LNbits talks to the Blink Bitcoin Lightning wallet provider. It adds a rate limiter (to avoid hammering Blink's API), caches payment-status answers, spaces out repeated status checks with increasing delays, and fixes a bug where a failed BOLT11 invoice decode could crash a payment. The changes are defensive: they reduce API load and make payment handling more robust, but they also introduce new concurrency and caching logic that could hide edge-case bugs.

Recommended action

Review the new caching and lock cleanup paths for memory leaks or stale-state bugs; verify that _status_locks entries are always removed when terminal status is reached or on cache expiry; run the new unit tests and integration tests against a real Blink environment; monitor for stuck pending invoices after this change.

Security signals we found

01

New rate limiter reduces risk of API abuse / self-DoS against Blink GraphQL endpoint

02

Caching of terminal payment status may mask stale or incorrect state if cache invalidation is incomplete

03

Concurrent status-check coalescing with per-checking_id lock could leak memory if locks are not removed on all paths

04

pay_invoice now catches BOLT11 decode failures and returns a structured error rather than raising

05

pay_invoice now returns pending PaymentResponse with checking_id on API exception, improving idempotency but relying on caller to retry

06

WebSocket listener runs in a background task and is cancelled on stream exit; shutdown flag added

Risk score

Why this scored 27/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 6/15
Confidence 6/10
Evidence quality 3/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.