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

Account for message type prefix len in prevtx length enforcement

Public commit record

What the developer wrote

Authored by Wilmer Paulino

73/100 · Adequate
Account for message type prefix len in prevtx length enforcement

Lightning wire messages have a maximum size of 65535 bytes, which
already accounts for the required two-byte message type prefix. Our
`TxAddInput::prevtx` length enforcement relied solely on the
`serialized_length` of the message, which does not account for the
prefix.
✓ Specific, 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 small but real accounting bug in how rust-lightning checks whether a previous transaction (prevtx) attached to a funding input will make the resulting Lightning wire message too large. The code previously compared the message body length against the 65,535-byte wire limit, but forgot to add the 2-byte message type prefix. That meant a prevtx could be accepted even though the final on-the-wire message would exceed the protocol's maximum size, which would likely cause the peer to reject or fail to parse the message. The fix adds those 2 bytes to the calculation and updates the test to hit the real boundary.

Recommended action

Review whether any other message-size validations in the codebase also omit the 2-byte message type prefix. Backport to maintained release branches if dual-funding is enabled there. No immediate emergency response is indicated, but the fix should ride along with the next maintenance release.

Security signals we found

01

Off-by-constant length check in protocol message size enforcement

02

Potential acceptance of a prevtx that produces an oversized Lightning wire message

03

Denial-of-service / protocol-interop risk from peer message rejection

04

Test updated to exercise the corrected boundary

Risk score

Why this scored 45/100

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