External funding: ordinary opening timeout is not scheduled after signed submission
English | 中文
Summary
After a wallet submits a signed external-funding transaction to FNN, Fiber switches its timeout decision from the external-submission deadline to the ordinary opening deadline. The previously scheduled external check arrives before the ordinary deadline and correctly leaves the channel open, but no new check is scheduled. On the official v0.9.1 release, the initiating FNN kept running, yet the channel was still in CollaboratingFundingTx after the 180 s opening deadline instead of being aborted.
Environment and reproduction
- Official Fiber v0.9.1 release, CKB
0.202.0devnet (FNN log timestamps are UTC). - Initiating FNN configuration:
external_funding_timeout_seconds = 60,funding_timeout_seconds = 180. These shortened values preserve the release defaults' ordering: external deadline first (default 5 min), ordinary deadline later (default 1 day).
- Connect two v0.9.1 FNN nodes. On the initiating node, call
open_channel_with_external_fundingand obtain the unsigned transaction. Sign it with an external CKB wallet. - Pause the peer FNN process with
SIGSTOP, then callsubmit_signed_funding_txon the still-running initiating node before the 60 s external deadline. The peer cannot process the final transaction or continue the opening; the initiating node accepts the signed transaction. - Keep the initiating node running and poll
list_channels({"pubkey": peer_pubkey, "include_closed": true})for that channel ID every 10 s. The last recorded poll was about 192 s after the unsigned transaction was stored, beyond the 180 s opening deadline.
Pausing the peer holds the channel in CollaboratingFundingTx; the timeout check is handled locally by the initiating FNN, which keeps running.
Related history: Issue #1358 covered an ignored external check caused by sub-millisecond timestamp rounding after a restart, before signed submission; PR #1367 added 1 ms of scheduling grace. Here the initiating node is not restarted after channel creation, and signed submission moves the applicable deadline about 120 s later. That fix does not schedule the missing check.
Expected and observed
Expected: funding_timeout_seconds is documented as an automatic-close timeout, measured from channel creation. Once the signed transaction is submitted, Fiber's predicate selects that ordinary deadline. For CollaboratingFundingTx, can_abort_funding_on_timeout() explicitly returns true, so the initiating FNN should abort the opening if it remains in this state when the deadline expires.
Observed: The signed transaction was validated about 1 s after the unsigned transaction was stored. The initiating-node log records two ignored timeout checks around the 60 s external deadline. At the last poll, about 192 s after unsigned storage, the channel was still CollaboratingFundingTx; no funding-timeout abort for this channel appeared in the initiating-node log.
Evidence
Initiating-node log excerpt for channel 0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098 (verbatim):
2026-09-29T14:24:07.550563Z DEBUG fnn::fiber::channel: Storing unsigned funding tx for external funding channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098): Byte32(0x628a813d9a87cc745f70b70c42cdf31ec7d8a142bf3628d1bc24e933f47df3f7)
2026-09-29T14:24:08.703927Z DEBUG fnn::fiber::channel: Validated signed funding tx for external funding channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098): Hash256(0x628a813d9a87cc745f70b70c42cdf31ec7d8a142bf3628d1bc24e933f47df3f7)
2026-09-29T14:25:07.357700Z DEBUG fnn::fiber::channel: Ignore stale funding timeout check for channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098) in state CollaboratingFundingTx(CollaboratingFundingTxFlags(OUR_TX_COMPLETE_SENT | THEIR_TX_COMPLETE_SENT))
2026-09-29T14:25:07.554290Z DEBUG fnn::fiber::channel: Ignore stale funding timeout check for channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098) in state CollaboratingFundingTx(CollaboratingFundingTxFlags(OUR_TX_COMPLETE_SENT | THEIR_TX_COMPLETE_SENT))Reproduction output excerpt (verbatim; timestamps here are Unix seconds):
OPEN 1790691847.764 0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098
PEER_PAUSED 1790691848.585 pid=21388
SUBMIT 1790691848.715 {"channel_id": "0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098", "funding_tx_hash": "0x628a813d9a87cc745f70b70c42cdf31ec7d8a142bf3628d1bc24e933f47df3f7"}
POLL 1790692029.100 {"state_name": "CollaboratingFundingTx", "state_flags": "OUR_TX_COMPLETE_SENT|THEIR_TX_COMPLETE_SENT|COLLABORATION_COMPLETED"}
POLL 1790692039.122 {"state_name": "CollaboratingFundingTx", "state_flags": "OUR_TX_COMPLETE_SENT|THEIR_TX_COMPLETE_SENT|COLLABORATION_COMPLETED"}The last poll at 1790692039.122 is 2026-09-29 14:27:19.122 UTC, more than 191 s after the unsigned transaction was stored at 14:24:07.550 UTC. The 180 s deadline from channel creation had therefore passed.
Cause in Fiber v0.9.1
- Signed submission sets
signed_submitted = true; the timeout predicate then usescreated_at + funding_timeout_seconds. - The existing external checks arrive around 60 s. The handler correctly ignores them because the ordinary deadline has not elapsed, but schedules no replacement.
- Actor startup schedules the deadline applicable at that time; signed submission does not schedule the newly applicable ordinary check.
Suggested fix
When signed submission ends the external-submission wait, schedule a funding-timeout check for created_at + funding_timeout_seconds. Keep the existing behavior of leaving the channel open when an earlier external check arrives before the ordinary deadline.
中文版
External funding:提交已签名交易后,FNN 未按开通期限中止通道
概要
开通 external funding 通道时,FNN 先等待钱包提交已签名的 funding transaction。本次将等待钱包的期限设为 60 秒,将通道开通超时设为从创建起 180 秒。钱包及时提交后,FNN 在约 60 秒时没有关闭通道是对的,因为 180 秒还没到;问题是 FNN 也没有安排到 180 秒时再检查。我们用正式发布的 v0.9.1 复现:发起节点一直运行,对端暂时无法继续处理开通消息;超过 180 秒后,通道仍停在 CollaboratingFundingTx,没有因开通超时而中止。
环境与复现
- 使用 Fiber v0.9.1 正式版 和 CKB
0.202.0devnet(FNN 日志时间为 UTC)。 - 发起节点配置:
external_funding_timeout_seconds = 60、funding_timeout_seconds = 180。缩短时间只是为了加快复现;两者仍与默认值保持相同的先后顺序:等待钱包的期限先到(默认 5 分钟),通道开通期限后到(默认 1 天)。
- 启动并连接两个 v0.9.1 FNN 节点。发起节点调用
open_channel_with_external_funding,取得未签名的 funding transaction;外部 CKB 钱包为这笔交易签名。 - 用
SIGSTOP暂停对端 FNN,使它暂时不能处理后续开通消息。随后在 60 秒等待期限内,钱包向仍在运行的发起节点调用submit_signed_funding_tx;发起节点成功接收已签名交易。 - 发起节点始终保持运行。每 10 秒调用
list_channels({"pubkey": peer_pubkey, "include_closed": true}),根据通道 ID 查看这条通道的状态。最后一次查询发生在未签名交易保存约 192 秒后,已经超过 180 秒的开通期限。
暂停对端是为了让通道停在 CollaboratingFundingTx;超时检查由持续运行的发起节点在本地处理。
相关历史:Issue #1358 发生在钱包尚未提交签名、节点重启之后。时间戳不足 1 毫秒的误差使检查被忽略;PR #1367 为此给检查时间增加了 1 毫秒余量。本次创建通道后,发起节点没有重启,钱包已经提交交易,适用期限比原先的检查时间晚约 120 秒;上述修复无法补上这次缺失的检查。
预期与实际
**预期:**配置项 funding_timeout_seconds 控制 FNN 何时自动关闭仍未开通的通道,时间从创建通道起算。钱包提交已签名交易后,FNN 的超时判断就改用这个开通期限。对于 CollaboratingFundingTx,can_abort_funding_on_timeout() 明确返回 true,因此 180 秒到了而通道仍停在该状态时,发起节点应中止开通。
**实际:**发起节点保存未签名交易约 1 秒后,就验证通过了钱包提交的已签名交易。约 60 秒时,发起节点日志中有两条忽略超时检查的记录。到最后一次查询时,距离保存未签名交易已约 192 秒,通道仍停在 CollaboratingFundingTx;节点日志也没有这条通道因开通超时而中止的记录。
证据
发起节点的日志摘录:通道 0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098(原文):
2026-09-29T14:24:07.550563Z DEBUG fnn::fiber::channel: Storing unsigned funding tx for external funding channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098): Byte32(0x628a813d9a87cc745f70b70c42cdf31ec7d8a142bf3628d1bc24e933f47df3f7)
2026-09-29T14:24:08.703927Z DEBUG fnn::fiber::channel: Validated signed funding tx for external funding channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098): Hash256(0x628a813d9a87cc745f70b70c42cdf31ec7d8a142bf3628d1bc24e933f47df3f7)
2026-09-29T14:25:07.357700Z DEBUG fnn::fiber::channel: Ignore stale funding timeout check for channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098) in state CollaboratingFundingTx(CollaboratingFundingTxFlags(OUR_TX_COMPLETE_SENT | THEIR_TX_COMPLETE_SENT))
2026-09-29T14:25:07.554290Z DEBUG fnn::fiber::channel: Ignore stale funding timeout check for channel Hash256(0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098) in state CollaboratingFundingTx(CollaboratingFundingTxFlags(OUR_TX_COMPLETE_SENT | THEIR_TX_COMPLETE_SENT))复现过程的输出摘录(原文;此处时间戳为 Unix 秒):
OPEN 1790691847.764 0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098
PEER_PAUSED 1790691848.585 pid=21388
SUBMIT 1790691848.715 {"channel_id": "0x2de7ff195d11642428303c2dd5821fd0b22ea0d7903d1b7593f1891e9fecf098", "funding_tx_hash": "0x628a813d9a87cc745f70b70c42cdf31ec7d8a142bf3628d1bc24e933f47df3f7"}
POLL 1790692029.100 {"state_name": "CollaboratingFundingTx", "state_flags": "OUR_TX_COMPLETE_SENT|THEIR_TX_COMPLETE_SENT|COLLABORATION_COMPLETED"}
POLL 1790692039.122 {"state_name": "CollaboratingFundingTx", "state_flags": "OUR_TX_COMPLETE_SENT|THEIR_TX_COMPLETE_SENT|COLLABORATION_COMPLETED"}最后一次查询的时间 1790692039.122 对应 2026-09-29 14:27:19.122 UTC。未签名交易在 14:24:07.550 UTC 保存,两者相隔超过 191 秒;通道创建得更早,所以从创建起算的 180 秒期限肯定也已过去。
Fiber v0.9.1 中的原因
- FNN 收到钱包提交的已签名交易后,把
signed_submitted设为true。超时判断随之改用created_at + funding_timeout_seconds。 - FNN 先前安排的检查约在 60 秒时到来。这时 180 秒尚未过去,FNN 忽略检查是对的,却没有安排 180 秒到期后的下一次检查。
- ChannelActor 启动时只会按当时适用的期限安排检查;收到已签名交易时没有安排新的检查。
建议修复
FNN 收到已签名交易后,应按 created_at + funding_timeout_seconds 安排一次开通超时检查。先前的检查如果在这个期限前到来,仍不应提前关闭通道。
Source: nervosnetwork/fiber