mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-20 13:04:28 +02:00
contractcourt: update the commitSweepResolver to be aware of tweakless commits
In this commit, we update the `commitSweepResolver` to be aware of tweakless commitments. We'll now use the new behavior of the uni close summary (leaving out the single tweak) to detect if we're dealing with a new, or modern commitment. Depending on the commitment type, we'll then set the witness type accordingly so we can generate the proper signature within the sweeper.
This commit is contained in:
@@ -89,12 +89,23 @@ func (c *commitSweepResolver) Resolve() (ContractResolver, error) {
|
|||||||
isLocalCommitTx := c.commitResolution.MaturityDelay != 0
|
isLocalCommitTx := c.commitResolution.MaturityDelay != 0
|
||||||
|
|
||||||
if !isLocalCommitTx {
|
if !isLocalCommitTx {
|
||||||
|
// There're two types of commitments, those that have tweaks
|
||||||
|
// for the remote key (us in this case), and those that don't.
|
||||||
|
// We'll rely on the presence of the commitment tweak to to
|
||||||
|
// discern which type of commitment this is.
|
||||||
|
var witnessType input.WitnessType
|
||||||
|
if c.commitResolution.SelfOutputSignDesc.SingleTweak == nil {
|
||||||
|
witnessType = input.CommitSpendNoDelayTweakless
|
||||||
|
} else {
|
||||||
|
witnessType = input.CommitmentNoDelay
|
||||||
|
}
|
||||||
|
|
||||||
// We'll craft an input with all the information required for
|
// We'll craft an input with all the information required for
|
||||||
// the sweeper to create a fully valid sweeping transaction to
|
// the sweeper to create a fully valid sweeping transaction to
|
||||||
// recover these coins.
|
// recover these coins.
|
||||||
inp := input.MakeBaseInput(
|
inp := input.MakeBaseInput(
|
||||||
&c.commitResolution.SelfOutPoint,
|
&c.commitResolution.SelfOutPoint,
|
||||||
input.CommitmentNoDelay,
|
witnessType,
|
||||||
&c.commitResolution.SelfOutputSignDesc,
|
&c.commitResolution.SelfOutputSignDesc,
|
||||||
c.broadcastHeight,
|
c.broadcastHeight,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user