Failure to reject absurdly high channel reserves
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 openingd/common.c 中第 126-144 行附近的聚合储备检查开始,跟踪 channel_reserve_satoshis 的通道开启验证。确认在两个余额都低于储备时,提供的参数会被拒绝,并根据 issue 建议的限制验证对方储备上限的行为。
由索引模型根据 Issue 内容生成。
描述
BOLT 2 has one required and one suggested check that provide an upper limit on the channel reserve imposed by the counterparty:
-
The receiving node MUST fail the channel if: - both `to_local` and `to_remote` amounts for the initial commitment transaction are less than or equal to `channel_reserve_satoshis` -
The receiving node MAY fail the channel if: - it considers `channel_reserve_satoshis` too large.
CLN implements neither.
Impact
CLN will accept a channel reserve larger than its own initial balance, leaving it unable to send anything on the channel until the funder chooses to push more funds to it. For example, CLN accepts the following channel parameters:
funding_satoshis = 100_000
push_msat = 20_000_000
feerate_per_kw = 500
channel_reserve_satoshis = 87_000
channel_type = anchors
The balances on the initial commitment transaction after fees are:
to_local (funder) = 78_778 sat
to_remote (CLN) = 20_000 sat
Both sides are below the reserve, so CLN cannot spend until it has received a further sats, and the funder is under no obligation to ever send it. CLN's balance is still recoverable on-chain by closing the channel.
One thing to note is that CLN does impose the aggregate reserve check on the funding amount: https://github.com/ElementsProject/lightning/blob/c1551c557cc524e2241f9cbae7d3895b1b0b627c/openingd/common.c#L126-L144 This rejects cases where aggregate reserve/fee exceeds the channel capacity, but misses cases where the capacity covers the fee and reserve, yet after pushing some amount to the peer, both balances fall below the reserve.
Suggested fix
Add a check for requirement 1 above, as mandated by the spec.
Also add a cap on the channel reserve imposed by the counterparty. For reference, LND caps at 20% of capacity and Eclair caps at 5%.
Discovery
The missing specification check was detected while fuzzing with smite.
- 主要语言
- C
- 星标
- 3.1k
- 派生
- 1k
- 平均合并
- 3 天 10 小时
- 30 天内合并 PR
- 40
环境准备
- 提供 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
-
Feature Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
openwrt/firmware-utils#82 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
FujiNetWIFI/fujinet-firmware#1849 ·
维护者通常 1 天内回复
-
area:http-gateway good first issue priority:low type:bug
难度 2/5 1-3 小时 新手友好度 78/100
crazy-goat/php-fpm-ng#870 ·
维护者通常 1 天内回复