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

plugins/test: Add a test to trigger the bug

Public commit record

What the developer wrote

Authored by Chandra Pratap

70/100 · Adequate
plugins/test: Add a test to trigger the bug

Add a test in `plugins/test/run-route-calc.c` that reproduces the
runtime error when the fix is not applied.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds a test case that reproduces a bug in Core Lightning's payment routing code. When a payment amount is larger than a channel's capacity, the router should simply report 'no path found.' Instead, due to a precision issue with how channel capacity limits are stored, the router can compute an invalid 'NaN' (not-a-number) score and then try to convert that NaN into an ordinary unsigned integer. That conversion triggers a runtime/undefined-behavior error. The commit only adds the test; the actual fix is in a separate commit not shown here.

Recommended action

Locate and review the companion fix commit for route_score()/route() and the fp16_t capacity handling. Ensure the fix correctly discards channels whose effective capacity is below the payment amount, and that NaN scores cannot propagate into integer types. Run the new test under UBSan/ASan to confirm the bug is fixed.

Security signals we found

01

Undefined behavior triggered by NaN-to-unsigned-integer cast

02

Type precision loss in fp16_t capacity representation

03

Routing logic fails to discard insufficient-capacity channels

04

Regression test added for a known bug

Risk score

Why this scored 56/100

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