input/witnessgen: define witness type for HTLC 2nd level inputs

These will only be used for size upper bound estimations by the sweeper.
This commit is contained in:
Johan T. Halseth 2020-12-09 12:24:02 +01:00
parent 8eb6d7cf87
commit 65e50f6952
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -80,6 +80,14 @@ const (
// result, we can only spend this after a CSV delay. // result, we can only spend this after a CSV delay.
HtlcOfferedTimeoutSecondLevel StandardWitnessType = 5 HtlcOfferedTimeoutSecondLevel StandardWitnessType = 5
// HtlcOfferedTimeoutSecondLevelInputConfirmed is a witness that allows
// us to sweep an HTLC output that we extended to a party, but was
// never fulfilled. This _is_ the HTLC output directly on our
// commitment transaction, and the input to the second-level HTLC
// tiemout transaction. It can only be spent after CLTV expiry, and
// commitment confirmation.
HtlcOfferedTimeoutSecondLevelInputConfirmed StandardWitnessType = 15
// HtlcAcceptedSuccessSecondLevel is a witness that allows us to sweep // HtlcAcceptedSuccessSecondLevel is a witness that allows us to sweep
// an HTLC output that was offered to us, and for which we have a // an HTLC output that was offered to us, and for which we have a
// payment preimage. This HTLC output isn't directly on our commitment // payment preimage. This HTLC output isn't directly on our commitment
@ -87,6 +95,14 @@ const (
// transaction. As a result, we can only spend this after a CSV delay. // transaction. As a result, we can only spend this after a CSV delay.
HtlcAcceptedSuccessSecondLevel StandardWitnessType = 6 HtlcAcceptedSuccessSecondLevel StandardWitnessType = 6
// HtlcAcceptedSuccessSecondLevelInputConfirmed is a witness that
// allows us to sweep an HTLC output that was offered to us, and for
// which we have a payment preimage. This _is_ the HTLC output directly
// on our commitment transaction, and the input to the second-level
// HTLC success transaction. It can only be spent after the commitment
// has confirmed.
HtlcAcceptedSuccessSecondLevelInputConfirmed StandardWitnessType = 16
// HtlcOfferedRemoteTimeout is a witness that allows us to sweep an // HtlcOfferedRemoteTimeout is a witness that allows us to sweep an
// HTLC that we offered to the remote party which lies in the // HTLC that we offered to the remote party which lies in the
// commitment transaction of the remote party. We can spend this output // commitment transaction of the remote party. We can spend this output
@ -163,9 +179,15 @@ func (wt StandardWitnessType) String() string {
case HtlcOfferedTimeoutSecondLevel: case HtlcOfferedTimeoutSecondLevel:
return "HtlcOfferedTimeoutSecondLevel" return "HtlcOfferedTimeoutSecondLevel"
case HtlcOfferedTimeoutSecondLevelInputConfirmed:
return "HtlcOfferedTimeoutSecondLevelInputConfirmed"
case HtlcAcceptedSuccessSecondLevel: case HtlcAcceptedSuccessSecondLevel:
return "HtlcAcceptedSuccessSecondLevel" return "HtlcAcceptedSuccessSecondLevel"
case HtlcAcceptedSuccessSecondLevelInputConfirmed:
return "HtlcAcceptedSuccessSecondLevelInputConfirmed"
case HtlcOfferedRemoteTimeout: case HtlcOfferedRemoteTimeout:
return "HtlcOfferedRemoteTimeout" return "HtlcOfferedRemoteTimeout"
@ -375,12 +397,20 @@ func (wt StandardWitnessType) SizeUpperBound() (int, bool, error) {
case HtlcOfferedTimeoutSecondLevel: case HtlcOfferedTimeoutSecondLevel:
return ToLocalTimeoutWitnessSize, false, nil return ToLocalTimeoutWitnessSize, false, nil
// Input to the outgoing HTLC second layer timeout transaction.
case HtlcOfferedTimeoutSecondLevelInputConfirmed:
return OfferedHtlcTimeoutWitnessSizeConfirmed, false, nil
// Incoming second layer HTLC's that have confirmed within the // Incoming second layer HTLC's that have confirmed within the
// chain, and the output they produced is now mature enough to // chain, and the output they produced is now mature enough to
// sweep. // sweep.
case HtlcAcceptedSuccessSecondLevel: case HtlcAcceptedSuccessSecondLevel:
return ToLocalTimeoutWitnessSize, false, nil return ToLocalTimeoutWitnessSize, false, nil
// Input to the incoming second-layer HTLC success transaction.
case HtlcAcceptedSuccessSecondLevelInputConfirmed:
return AcceptedHtlcSuccessWitnessSizeConfirmed, false, nil
// An HTLC on the commitment transaction of the remote party, // An HTLC on the commitment transaction of the remote party,
// that has had its absolute timelock expire. // that has had its absolute timelock expire.
case HtlcOfferedRemoteTimeout: case HtlcOfferedRemoteTimeout: