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

Fix spurious `debug_assert` in UTXO gossip dedup check

Public commit record

What the developer wrote

Authored by Elias Rohrer

85/100 · Strong
Fix spurious `debug_assert` in UTXO gossip dedup check

`check_replace_previous_entry` hit `debug_assert!(false)` when
`channel_announce` was `None` on a still-live `UtxoMessages`. The
comment claimed this was unreachable because `channel_announce` is set
under the same lock as the channel map entry. However, there is a
legitimate race:

1. A channel announcement arrives, an async UTXO lookup starts, and
`pending_channels[scid]` is set with a `Weak` to the
`UtxoMessages`.
2. The lookup resolves. `resolve_single_future` takes both
`channel_announce` and `complete` via `.take()`, but the
`Arc<Mutex<UtxoMessages>>` is still alive on the stack of
`check_resolved_futures`.
3. A duplicate announcement for the same SCID arrives during this
window. `check_replace_previous_entry` upgrades the `Weak`,
finds `channel_announce` is `None`, and hits the assert.

Replace the unconditional `debug_assert!(false)` with a targeted check
that `complete` has also been taken (confirming the future resolved),
which would catch a genuinely unexpected state where
`channel_announce` is `None` but `complete` is still pending.

Co-Authored-By: HAL 9000
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a harmless but incorrect internal sanity check (a debug-only assertion) in the Lightning Dev Kit's code that handles duplicate routing announcements. The assertion could fire in a legitimate race condition even though nothing was wrong. The fix replaces the overly broad assertion with a more precise one that only complains if the program state is genuinely inconsistent. It is not a security vulnerability and cannot be exploited by an attacker.

Recommended action

No security action required. Treat as a normal code-quality/debugging fix. If running debug builds, update to avoid spurious assertion failures during duplicate channel announcements.

Security signals we found

01

debug_assert only affects debug builds, not production

02

Race condition is benign and already handled by falling through to non-matching behavior

03

No memory safety issue, no panic in release builds, no authentication bypass

04

Commit explicitly describes the scenario as legitimate and not a bug in logic

Risk score

Why this scored 25/100

Our methodology →
Potential impact 5/30
Exploitability 0/25
Stealth signal 3/15
Affected reach 5/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.