lnwallet: split ResolutionBlob into local vs remote for breach

When we're handling a breach, we'll be sweeping from both the local and
remote outputs, so we'll carve out two blob areas for that.
This commit is contained in:
Olaoluwa Osuntokun 2024-06-23 23:29:34 -07:00 committed by Oliver Gugger
parent 85e288d1fd
commit c2927d8212
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -2466,6 +2466,10 @@ type HtlcRetribution struct {
// this HTLC was offered by us. This flag is used determine the exact
// witness type should be used to sweep the output.
IsIncoming bool
// ResolutionBlob is a blob used for aux channels that permits a
// spender of this output to claim all funds.
ResolutionBlob fn.Option[tlv.Blob]
}
// BreachRetribution contains all the data necessary to bring a channel
@ -2536,10 +2540,13 @@ type BreachRetribution struct {
// have access to the public keys used in the scripts.
KeyRing *CommitmentKeyRing
// ResolutionBlob is a blob used for aux channels that permits a
// spender of the output to properly resolve it in the case of a force
// close.
ResolutionBlob fn.Option[tlv.Blob]
// LocalResolutionBlob is a blob used for aux channels that permits an
// honest party to sweep the local commitment output.
LocalResolutionBlob fn.Option[tlv.Blob]
// RemoteResolutionBlob is a blob used for aux channels that permits an
// honest party to sweep the remote commitment output.
RemoteResolutionBlob fn.Option[tlv.Blob]
}
// NewBreachRetribution creates a new fully populated BreachRetribution for the
@ -2736,7 +2743,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
return nil, fmt.Errorf("unable to aux resolve: %w", err)
}
br.ResolutionBlob = resolveBlob.Option()
br.LocalResolutionBlob = resolveBlob.Option()
}
// Similarly, if their balance exceeds the remote party's dust limit,
@ -2810,7 +2817,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
return nil, fmt.Errorf("unable to aux resolve: %w", err)
}
br.ResolutionBlob = resolveBlob.Option()
br.RemoteResolutionBlob = resolveBlob.Option()
}
// Finally, with all the necessary data constructed, we can pad the