input: update CommitSpendNoDelay to be aware of tweakless commits, add new witness type
In this commit, we update the `CommitSpendNoDelay` method to be aware of the alternate spending mechanism for commitments that don't have a tweak for the remote party's non-delay output. We also add a new witness type so callers can convey their expected signing path.
This commit is contained in:
3 files changed
+42
-9
No files matched your search
+19
-1
@@ -79,6 +79,11 @@ const (
|
||||
// output that sends to a nested P2SH script that pays to a key solely
|
||||
// under our control. The witness generated needs to include the
|
||||
NestedWitnessKeyHash WitnessType = 11
|
||||
|
||||
// CommitSpendNoDelayTweakless is similar to the CommitSpendNoDelay
|
||||
// type, but it omits the tweak that randomizes the key we need to
|
||||
// spend with a channel peer supplied set of randomness.
|
||||
CommitSpendNoDelayTweakless = 12
|
||||
)
|
||||
|
||||
// Stirng returns a human readable version of the target WitnessType.
|
||||
@@ -90,6 +95,9 @@ func (wt WitnessType) String() string {
|
||||
case CommitmentNoDelay:
|
||||
return "CommitmentNoDelay"
|
||||
|
||||
case CommitSpendNoDelayTweakless:
|
||||
return "CommitmentNoDelayTweakless"
|
||||
|
||||
case CommitmentRevoke:
|
||||
return "CommitmentRevoke"
|
||||
|
||||
@@ -153,7 +161,17 @@ func (wt WitnessType) GenWitnessFunc(signer Signer,
|
||||
}, nil
|
||||
|
||||
case CommitmentNoDelay:
|
||||
witness, err := CommitSpendNoDelay(signer, desc, tx)
|
||||
witness, err := CommitSpendNoDelay(signer, desc, tx, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Script{
|
||||
Witness: witness,
|
||||
}, nil
|
||||
|
||||
case CommitSpendNoDelayTweakless:
|
||||
witness, err := CommitSpendNoDelay(signer, desc, tx, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user