包含隐含空指针引用的通道打开竞赛
作者: morehouse创建于 2026年9月24日更新于 2026年9月24日
根本原因 竞争和 nil 解引用发生在 restoreCommitState 中:
pendingRemoteCommitDiff, err = lc.channelState.RemoteCommitChainTip() // DB read
if err != nil && err != channeldb.ErrNoPendingCommit {
return err
}
if pendingRemoteCommitDiff != nil {
pendingCommitPoint := lc.channelState.RemoteNextRevocation // IN-MEMORY field
...
pendingRemoteKeyChain = DeriveCommitmentKeys(pendingCommitPoint, ...) // no nil check
}"是否有待处理的提交?" 从数据库中读取。 "对方的下一个撤销点是什么?" 从内存结构中读取。
内容来源: lightningnetwork/lnd