Failure to reject `open_channel` where funder cannot pay commitment fee
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu với luồng xử lý open_channel và so sánh thời điểm xác thực của nó với common/initial_commit_tx.c, đặc biệt là việc kiểm tra fee hiện có tại các dòng được liên kết. Chạy test_open_channel_funder_cannot_afford_fee từ bản tái hiện và xác nhận rằng peer nhận được WIRE_WARNING hoặc WIRE_ERROR trước funding_created; channel phải bị từ chối khi push_msat khiến số dư không đủ cho commitment fee.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 3.1k
- Fork
- 1k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ElementsProject/lightning
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/lightning#9593 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ElementsProject/lightning#9322 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ElementsProject/lightning#9206 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ElementsProject/lightning#9187 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
QA
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ElementsProject/lightning#9117 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của ElementsProject/lightning
Issue tương tự
-
chore(gateway): emit INFO budget reserved/settled logs for proactivity v2 (chip task_2855f4ec)Đang mởbackend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
BasedHardware/omi#20940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Linux notifications: the default action's ' ' label shows as a blank button in xfce4-notifydĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kovidgoyal/kitty#10625 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày