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

bip158: Return no match for empty query

Public commit record

What the developer wrote

Authored by rustaceanrob

68/100 · Adequate
bip158: Return no match for empty query

Perhaps this is up for debate, but considering the use case of checking
for inclusions in a block, an empty query should not return `true` for any
element, as no elements exist in the query. If the user happens to have
no scripts to query for whatever reason, they will think every block is
relevant.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a logic bug in Bitcoin's BIP158 compact block filter code. Previously, if a user asked 'Is anything in this block relevant to me?' but provided an empty list of things to look for, the code incorrectly answered 'Yes, it matches.' This could make wallet or node software think every block was relevant, wasting resources, triggering unnecessary downloads, or causing denial-of-service-like behavior. The fix makes an empty query correctly return 'No match.'

Recommended action

Review all callers of GcsFilterReader::match_any() and related match methods to confirm they handle empty queries safely. Backport the one-line fix to maintained release branches. Add a regression test covering the empty-query case.

Security signals we found

01

Logic error causing false-positive match for empty query

02

Potential resource exhaustion / DoS vector if attacker can trigger empty-query checks against many blocks

03

BIP158 block-filter API misuse risk

Risk score

Why this scored 51/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 10/15
Affected reach 10/15
Confidence 7/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.