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

lnonion/trampoline: stop double counting HMAC size

Public commit record

What the developer wrote

Authored by f321x

73/100 · Adequate
lnonion/trampoline: stop double counting HMAC size

`OnionHopsDataSingle.to_bytes()` already accounts for the
onions hmac internally, it seems incorrect that we were
additionally adding `PER_HOP_HMAC_SIZE` to the payload size
of the payload returned by `.to_bytes()`.
✓ 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 bug in Electrum's Lightning payment routing where the size of a per-hop authentication value (HMAC) was being counted twice when building onion packets. The fix removes the extra count, which could previously have caused Electrum to think a trampoline payment payload was larger than it actually is. The practical effect is likely limited to routing failures or incorrect payload budgeting for trampoline payments, rather than direct theft of funds.

Recommended action

Review whether the double-counting could have caused any trampoline payment failures or unexpected routing behavior in the wild. No immediate emergency action is indicated, but users relying on trampoline payments should upgrade to the fixed version. Consider adding a regression test that asserts payload_size equals the sum of to_bytes() lengths for constructed onions.

Security signals we found

01

Lightning onion payload size miscalculation

02

Trampoline routing tag inclusion logic affected

03

Potential for payment path construction failure or non-standard onion sizing

04

No direct cryptographic weakness introduced; bug is in size accounting

Risk score

Why this scored 35/100

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