lnwallet: modify NewUnilateralCloseSummary to be aware of pending remote commits

In this commit, we modify the NewUnilateralCloseSummary to be able to
distinguish between a unilateral closure using the lowest+highest
commitment the remote party possesses. Before this commit, if the remote
party broadcast their highest commitment, when they have a lower
unrevoked commitment, then this function would fail to find the proper
output, leaving funds on the chain.

To fix this, it's now the duty of the caller to pass remotePendingCommit
with the proper value. The caller should use the lowest unrevoked
commitment, and the height hint of the broadcast commitment to discern
if this is a pending commitment or not.
This commit is contained in:
Olaoluwa Osuntokun committed 2018-05-03 21:29:28 -07:00
1 parent 90bbc4f41b
commit 8b06817482
3 files changed
+30 -20

No files matched your search

+1 -1
View File
@@ -419,7 +419,7 @@ func TestCommitmentAndHTLCTransactions(t *testing.T) {
// of the dependencies.
channel := LightningChannel{
channelState: &channelState,
signer: signer,
Signer: signer,
localChanCfg: &channelState.LocalChanCfg,
remoteChanCfg: &channelState.RemoteChanCfg,
}