Skip to content

Commit 15f4011

Browse files
Roasbeefguggero
authored andcommitted
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.
1 parent a9ce6e4 commit 15f4011

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lnwallet/channel.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,10 @@ type HtlcRetribution struct {
19681968
// this HTLC was offered by us. This flag is used determine the exact
19691969
// witness type should be used to sweep the output.
19701970
IsIncoming bool
1971+
1972+
// ResolutionBlob is a blob used for aux channels that permits a
1973+
// spender of this output to claim all funds.
1974+
ResolutionBlob fn.Option[tlv.Blob]
19711975
}
19721976

19731977
// BreachRetribution contains all the data necessary to bring a channel
@@ -2038,10 +2042,13 @@ type BreachRetribution struct {
20382042
// have access to the public keys used in the scripts.
20392043
KeyRing *CommitmentKeyRing
20402044

2041-
// ResolutionBlob is a blob used for aux channels that permits a
2042-
// spender of the output to properly resolve it in the case of a force
2043-
// close.
2044-
ResolutionBlob fn.Option[tlv.Blob]
2045+
// LocalResolutionBlob is a blob used for aux channels that permits an
2046+
// honest party to sweep the local commitment output.
2047+
LocalResolutionBlob fn.Option[tlv.Blob]
2048+
2049+
// RemoteResolutionBlob is a blob used for aux channels that permits an
2050+
// honest party to sweep the remote commitment output.
2051+
RemoteResolutionBlob fn.Option[tlv.Blob]
20452052
}
20462053

20472054
// NewBreachRetribution creates a new fully populated BreachRetribution for the
@@ -2239,7 +2246,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
22392246
return nil, fmt.Errorf("unable to aux resolve: %w", err)
22402247
}
22412248

2242-
br.ResolutionBlob = resolveBlob.Option()
2249+
br.LocalResolutionBlob = resolveBlob.Option()
22432250
}
22442251

22452252
// Similarly, if their balance exceeds the remote party's dust limit,
@@ -2313,7 +2320,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
23132320
return nil, fmt.Errorf("unable to aux resolve: %w", err)
23142321
}
23152322

2316-
br.ResolutionBlob = resolveBlob.Option()
2323+
br.RemoteResolutionBlob = resolveBlob.Option()
23172324
}
23182325

23192326
// Finally, with all the necessary data constructed, we can pad the

0 commit comments

Comments
 (0)