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

askrene: correctly order constraints.

Public commit record

What the developer wrote

Authored by Rusty Russell

58/100 · Thin
askrene: correctly order constraints.

Pure "constraints" don't care about order (they simply clamp max and
min), but "impressions" are relative, so they do. Change the
hashtable to keep them timestamp sorted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Descriptive subject✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in Core Lightning's routing helper (askrene) where two kinds of channel information—hard limits called 'constraints' and usage estimates called 'impressions'—were being applied in the wrong order. Because impressions are time-relative, applying them out of order could make the router think a channel has more or less available capacity than it really does. The patch merges the two data structures and keeps them sorted by timestamp so they are applied in the correct sequence. The included test demonstrates that the wrong ordering could cause a payment route to be accepted when it should be rejected, or vice versa.

Recommended action

Review the merged channel_intel lifecycle and ownership (tal_steal) for memory leaks or use-after-free, especially during layer_trim_constraints where the array is reallocated while iterating. Confirm that all callers of layer_apply_constraints rely on timestamp ordering and that no other code still assumes constraints are applied before impressions.

Security signals we found

01

Routing decision bug caused by incorrect ordering of time-relative channel state

02

Potential payment failure or acceptance of an over-capacity route

03

Regression test added demonstrating incorrect route acceptance before fix

04

Data structure change from duplicate-allowed hash tables to single timestamp-ordered array

Risk score

Why this scored 49/100

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