Failure to reject `open_channel` where funder cannot pay commitment fee
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- networking
调研方向
从 open_channel 处理路径开始,将其验证时机与 common/initial_commit_tx.c 进行比较,尤其是与链接行中现有的费用检查进行比较。运行复现中的 test_open_channel_funder_cannot_afford_fee,并确认 peer 在 funding_created 之前收到 WIRE_WARNING 或 WIRE_ERROR;当 push_msat 导致资金不足以支付 commitment fee 时,必须拒绝该 channel。
由索引模型根据 Issue 内容生成。
描述
BOLT 2 requires the receiver of open_channel to fail the channel when the funder's amount cannot cover the initial commitment fee:
The receiving node MUST fail the channel if:
- the funder's amount for the initial commitment transaction is not sufficient for full [fee payment](03-transactions.md#fee-payment).
CLN implements the rule, but too late. The channel isn't rejected until later in the flow, after receiving funding_created.
Impact
A peer can set a push_msat for the channel that leaves insufficient funds to pay the initial commitment fees. CLN initially accepts such channels and responds with accept_channel, even though it will inevitably reject them one roundtrip later in the funding flow (after receiving funding_created). This is entirely a spec compliance issue.
Reproduction
@pytest.mark.openchannel('v1')
def test_open_channel_funder_cannot_afford_fee(node_factory, bitcoind):
"""A funder left short of the commitment fee must be rejected.
BOLT 2: the receiving node MUST fail the channel if the funder's amount for
the initial commitment transaction is not sufficient for full fee payment.
CLN only notices in initial_commit_tx(), after accept_channel has gone out.
"""
l1 = node_factory.get_node()
chain_hash = bytes.fromhex(bitcoind.rpc.getblockhash(0))[::-1]
# Use the node's own opening feerate, so we're inside its accepted range.
feerate = l1.rpc.feerates('perkw')['perkw']['opening']
funding_sat = 16777216
# The funder pays the commitment fee out of its own balance, so pushing the
# balance away leaves it with nothing to pay from.
push_msat = funding_sat * 1000
lconn, channel_type = raw_peer_connect(l1)
temp_chan_id = os.urandom(32)
send_open_channel(lconn, chain_hash, temp_chan_id, funding_sat,
push_msat, feerate, channel_type)
mtype = read_channel_reply(lconn)
assert mtype in (WIRE_WARNING, WIRE_ERROR), \
"funder left with {} sat to pay the commitment fee was not rejected (got msgtype {})".format(
funding_sat - push_msat // 1000, mtype)
If we continue to flow to funding_created, the initial_commit_tx check rejects the channel:
UNUSUAL 034f355b...-openingd-chan#1: Funder cannot afford fee on initial commitment transaction
Suggested fix
Apply the same check that already exists in initial_commit_tx immediately after receiving accept_channel.
Discovery
Found while fuzzing the v1 funding protocol 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
-
Discover carries headerEdges that nothing reads since #1914 moved E0507/E0517 to the compiler graph未关闭tech-debt
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
2个显示的问题未关闭
难度 2/5 1-3 小时 新手友好度 62/100
coolsnowwolf/lede#14209 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
polhenarejos/pico-hsm#147 ·
-
难度 1/5 1 小时以内 新手友好度 85/100
OpenPrinting/cups#1746 ·
维护者通常 1 天内回复
-
Status: Opened
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复