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

blockencodings: fix extra transaction count

Public commit record

What the developer wrote

Authored by Lőrinc

68/100 · Adequate
blockencodings: fix extra transaction count

A short ID collision can invalidate a mempool-sourced transaction after an unrelated transaction was found in extra_txn.

Track each slot's source so extra_count is decremented only when the invalidated slot came from extra_txn. Mark collided slots explicitly so later candidates do not refill them.
✓ 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 bookkeeping bug in Bitcoin Core's compact block handling. When receiving a compressed block, the node tries to match short transaction IDs against its own mempool and a small cache of recently seen transactions ('extra_txn'). A bug caused the node to incorrectly decrement the 'extra_count' counter when a mempool-sourced transaction collided with a short ID, even though no extra_txn transaction was actually lost. This could lead to wrong internal counts and, in edge cases, prevent a collided slot from being correctly marked as unusable, potentially allowing later transactions to refill a slot that should stay empty. The fix tracks whether each matched slot came from the mempool, extra cache, or a collision, and only adjusts the appropriate counters.

Recommended action

Reviewers should verify that the TxSource state machine covers all transition paths (NONE -> MEMPOOL/EXTRA -> COLLIDED) and that no path allows a COLLIDED slot to be refilled. The added unit tests should be run to confirm the fix. Consider whether this bug could be triggered remotely via crafted short ID collisions and whether additional hardening is warranted.

Security signals we found

01

Incorrect internal accounting in compact block reconstruction

02

Short ID collision handling could misclassify transaction source

03

Potential for collided slots to be refilled by later candidates

04

Fix includes regression tests for counter correctness and collision terminal state

Risk score

Why this scored 48/100

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