askrene: clamp impression-adjusted min/max to channel capacity
维护者通常 2 天内回复
@Lagrang3 已经在做这个了。
开始于 2026年8月4日。
评估
这个 Issue 还没有评估数据。
描述
Follow-up from #9150.
layer_apply_constraints() applies impressions without bounding the result:
- reverse direction:
minandmaxboth grow byimp->amount, saturating atUINT64_MAX, with no clamp to the channel's gossmap capacity - forward direction: both shrink by
imp->amount, saturating at 0
Since #9150, get_constraints() seeds *max from gossmap_chan_get_capacity() instead of -1ULL, so reverse-direction impressions can push max above the channel's real capacity, and enough forward-direction volume drives max to 0 and makes askrene treat a live channel as dead.
The FIXME added to test_xpay_fake_channeld in that PR documents the symptom:
/* FIXME: We fail on #10, due mainly to a buildup of usage on 0x2134x0/0:
* Failed: We could not find a usable set of paths. The shortest path is
* 103x1x0->0x2134x0->1725x11x1725, but 0x2134x0/0 exceeds htlc_maximum_msat ~1000448msat
*/
Bounded in practice by two things: mcf.c defensively does if (min > max) min = max, and xpay calls askrene-age with a one-hour cutoff before every payment, so impressions expire. But the layer state is still incoherent in the meantime, and explain_failure.c documents an invariant (total >= max_capacity_known >= known_usable) that impressions can violate, since max can exceed cap_msat.
Minimum fix: clamp max to the channel capacity and min to max inside layer_apply_constraints().
Broader question, raised by Lagrang3 during review: the magnitude by which impressions move the bars is too aggressive. A successful payment proves liquidity of at least amount existed, so subtracting the full amount from max discards information rather than adding it. Worth revisiting the model alongside the clamp.
- 主要语言
- C
- 星标
- 3.1k
- 派生
- 1k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 45
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ElementsProject/lightning 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/lightning#9593 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ElementsProject/lightning#9322 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ElementsProject/lightning#9206 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ElementsProject/lightning#9187 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
QA
难度 1/5 1 小时以内 新手友好度 88/100
ElementsProject/lightning#9117 · 2 条评论 ·
维护者通常 2 天内回复
查看 ElementsProject/lightning 的全部 Issue
相似的 Issue
-
IO.get_env on Node truncates names at embedded NUL可能已有人在做 @Yi-111-a 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
HigherOrderCO/Bend#1449 · 1 条评论 ·
-
bug C/C++ code
难度 2/5 1-3 小时 新手友好度 70/100
webarkit/WebARKitLib#84 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
OpenPrinting/cups#1751 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
es-ude/OnDeviceTraining#488 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复