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

Fix underflow in blinded path amt_to_forward

Public commit record

What the developer wrote

Authored by Valentine Wallace

80/100 · Strong
Fix underflow in blinded path amt_to_forward

If we have a high (200%+) proportional fee as an intermediate blinded node
combined with a low inbound amount, we previously had some code that calculated
the outbound amount of the forward that would've underflowed. This would've
caused a panic in debug builds and caused us to relay a payment that should've
been rejected (due to being unable to cover our high fee) in release builds.

Reported by Project Loupe.
✓ 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 subtraction underflow bug in the code that decides how much of a Lightning payment a blinded intermediate node should forward. With extremely high proportional fees and a small incoming payment amount, the code subtracted a larger fee from a smaller amount, which would crash in debug builds and silently produce a wrong, too-small result in release builds. In release builds that wrong result could have allowed a payment to be relayed that should have been rejected because it could not cover the node's fee. The fix uses Rust's checked subtraction so the function returns 'None' instead of underflowing.

Recommended action

Apply the patch and run the new regression test. Review other fee/amount subtractions in the blinded path and routing code for similar unchecked arithmetic, and prefer checked_sub / saturating_sub patterns. No immediate external advisory action is required beyond normal release notes, but consider noting the fix because it affects payment relay correctness.

Security signals we found

01

Integer underflow in fee/amount calculation

02

Debug-build panic / release-build silent wraparound

03

Potential relay of under-funded payment in release builds

04

Blinded path intermediate node fee logic

05

Regression test added for underflow case

Risk score

Why this scored 70/100

Our methodology →
Potential impact 22/30
Exploitability 14/25
Stealth signal 10/15
Affected reach 10/15
Confidence 9/10
Evidence quality 5/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.