input: add CommitmentToRemoteConfirmed witness type
This commit is contained in:
parent
990992ce94
commit
6deb913a8d
@ -213,6 +213,22 @@ const (
|
||||
// - witness_script (to_local_script)
|
||||
ToLocalPenaltyWitnessSize = 1 + 1 + 73 + 1 + 1 + ToLocalScriptSize
|
||||
|
||||
// ToRemoteConfirmedScriptSize 37 bytes
|
||||
// - OP_DATA: 1 byte
|
||||
// - to_remote_key: 33 bytes
|
||||
// - OP_CHECKSIGVERIFY: 1 byte
|
||||
// - OP_1: 1 byte
|
||||
// - OP_CHECKSEQUENCEVERIFY: 1 byte
|
||||
ToRemoteConfirmedScriptSize = 1 + 33 + 1 + 1 + 1
|
||||
|
||||
// ToRemoteConfirmedWitnessSize 113 bytes
|
||||
// - number_of_witness_elements: 1 byte
|
||||
// - sig_length: 1 byte
|
||||
// - sig: 73 bytes
|
||||
// - witness_script_length: 1 byte
|
||||
// - witness_script (to_remote_delayed_script)
|
||||
ToRemoteConfirmedWitnessSize = 1 + 1 + 73 + 1 + ToRemoteConfirmedScriptSize
|
||||
|
||||
// AcceptedHtlcScriptSize 142 bytes
|
||||
// - OP_DUP: 1 byte
|
||||
// - OP_HASH160: 1 byte
|
||||
|
@ -48,8 +48,9 @@ type StandardWitnessType uint16
|
||||
var _ WitnessType = (StandardWitnessType)(0)
|
||||
|
||||
const (
|
||||
// CommitmentTimeLock is a witness that allows us to spend the output of
|
||||
// a commitment transaction after a relative lock-time lockout.
|
||||
// CommitmentTimeLock is a witness that allows us to spend our output
|
||||
// on our local commitment transaction after a relative lock-time
|
||||
// lockout.
|
||||
CommitmentTimeLock StandardWitnessType = 0
|
||||
|
||||
// CommitmentNoDelay is a witness that allows us to spend a settled
|
||||
@ -119,6 +120,11 @@ const (
|
||||
// type, but it omits the tweak that randomizes the key we need to
|
||||
// spend with a channel peer supplied set of randomness.
|
||||
CommitSpendNoDelayTweakless StandardWitnessType = 12
|
||||
|
||||
// CommitmentToRemoteConfirmed is a witness that allows us to spend our
|
||||
// output on the counterparty's commitment transaction after a
|
||||
// confirmation.
|
||||
CommitmentToRemoteConfirmed StandardWitnessType = 13
|
||||
)
|
||||
|
||||
// String returns a human readable version of the target WitnessType.
|
||||
@ -129,6 +135,9 @@ func (wt StandardWitnessType) String() string {
|
||||
case CommitmentTimeLock:
|
||||
return "CommitmentTimeLock"
|
||||
|
||||
case CommitmentToRemoteConfirmed:
|
||||
return "CommitmentToRemoteConfirmed"
|
||||
|
||||
case CommitmentNoDelay:
|
||||
return "CommitmentNoDelay"
|
||||
|
||||
@ -197,6 +206,18 @@ func (wt StandardWitnessType) WitnessGenerator(signer Signer,
|
||||
Witness: witness,
|
||||
}, nil
|
||||
|
||||
case CommitmentToRemoteConfirmed:
|
||||
witness, err := CommitSpendToRemoteConfirmed(
|
||||
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 {
|
||||
@ -323,6 +344,10 @@ func (wt StandardWitnessType) SizeUpperBound() (int, bool, error) {
|
||||
case CommitmentTimeLock:
|
||||
return ToLocalTimeoutWitnessSize, false, nil
|
||||
|
||||
// 1 CSV time locked output to us on remote commitment.
|
||||
case CommitmentToRemoteConfirmed:
|
||||
return ToRemoteConfirmedWitnessSize, false, nil
|
||||
|
||||
// Outgoing second layer HTLC's that have confirmed within the
|
||||
// chain, and the output they produced is now mature enough to
|
||||
// sweep.
|
||||
|
Loading…
Reference in New Issue
Block a user