input: add anchor witness type
This commit is contained in:
6 files changed
+155
-67
No files matched your search
@@ -125,6 +125,10 @@ const (
|
||||
// output on the counterparty's commitment transaction after a
|
||||
// confirmation.
|
||||
CommitmentToRemoteConfirmed StandardWitnessType = 13
|
||||
|
||||
// CommitmentAnchor is a witness that allows us to spend our anchor on
|
||||
// the commitment transaction.
|
||||
CommitmentAnchor StandardWitnessType = 14
|
||||
)
|
||||
|
||||
// String returns a human readable version of the target WitnessType.
|
||||
@@ -138,6 +142,9 @@ func (wt StandardWitnessType) String() string {
|
||||
case CommitmentToRemoteConfirmed:
|
||||
return "CommitmentToRemoteConfirmed"
|
||||
|
||||
case CommitmentAnchor:
|
||||
return "CommitmentAnchor"
|
||||
|
||||
case CommitmentNoDelay:
|
||||
return "CommitmentNoDelay"
|
||||
|
||||
@@ -218,6 +225,16 @@ func (wt StandardWitnessType) WitnessGenerator(signer Signer,
|
||||
Witness: witness,
|
||||
}, nil
|
||||
|
||||
case CommitmentAnchor:
|
||||
witness, err := CommitSpendAnchor(signer, desc, tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Script{
|
||||
Witness: witness,
|
||||
}, nil
|
||||
|
||||
case CommitmentNoDelay:
|
||||
witness, err := CommitSpendNoDelay(signer, desc, tx, false)
|
||||
if err != nil {
|
||||
@@ -348,6 +365,10 @@ func (wt StandardWitnessType) SizeUpperBound() (int, bool, error) {
|
||||
case CommitmentToRemoteConfirmed:
|
||||
return ToRemoteConfirmedWitnessSize, false, nil
|
||||
|
||||
// Anchor output on the commitment transaction.
|
||||
case CommitmentAnchor:
|
||||
return AnchorWitnessSize, false, nil
|
||||
|
||||
// Outgoing second layer HTLC's that have confirmed within the
|
||||
// chain, and the output they produced is now mature enough to
|
||||
// sweep.
|
||||
|
||||
Reference in new issue
Block a user