@@ -164,7 +164,7 @@ impl StaticPaymentOutputDescriptor {
164
164
/// originated from an anchor outputs channel, as they take the form of a P2WSH script.
165
165
pub fn witness_script ( & self ) -> Option < ScriptBuf > {
166
166
self . channel_transaction_parameters . as_ref ( ) . and_then ( |channel_params| {
167
- if channel_params. supports_anchors ( ) {
167
+ if channel_params. channel_type_features . supports_anchors_zero_fee_htlc_tx ( ) {
168
168
let payment_point = channel_params. holder_pubkeys . payment_point ;
169
169
Some ( chan_utils:: get_to_countersignatory_with_anchors_redeemscript ( & payment_point) )
170
170
} else {
@@ -177,7 +177,7 @@ impl StaticPaymentOutputDescriptor {
177
177
/// Note: If you have the grind_signatures feature enabled, this will be at least 1 byte
178
178
/// shorter.
179
179
pub fn max_witness_length ( & self ) -> u64 {
180
- if self . channel_transaction_parameters . as_ref ( ) . map_or ( false , |p| p . supports_anchors ( ) ) {
180
+ if self . needs_csv_1_for_spend ( ) {
181
181
let witness_script_weight = 1 /* pubkey push */ + 33 /* pubkey */ +
182
182
1 /* OP_CHECKSIGVERIFY */ + 1 /* OP_1 */ + 1 /* OP_CHECKSEQUENCEVERIFY */ ;
183
183
1 /* num witness items */ + 1 /* sig push */ + 73 /* sig including sighash flag */ +
@@ -186,6 +186,13 @@ impl StaticPaymentOutputDescriptor {
186
186
P2WPKH_WITNESS_WEIGHT
187
187
}
188
188
}
189
+
190
+ /// Returns true if spending this output requires a transaction with a CheckSequenceVerify
191
+ /// value of at least 1.
192
+ pub fn needs_csv_1_for_spend ( & self ) -> bool {
193
+ let chan_params = self . channel_transaction_parameters . as_ref ( ) ;
194
+ chan_params. map_or ( false , |p| p. channel_type_features . supports_anchors_zero_fee_htlc_tx ( ) )
195
+ }
189
196
}
190
197
impl_writeable_tlv_based ! ( StaticPaymentOutputDescriptor , {
191
198
( 0 , outpoint, required) ,
@@ -440,11 +447,7 @@ impl SpendableOutputDescriptor {
440
447
if !output_set. insert ( descriptor. outpoint ) {
441
448
return Err ( ( ) ) ;
442
449
}
443
- let sequence = if descriptor
444
- . channel_transaction_parameters
445
- . as_ref ( )
446
- . map_or ( false , |p| p. supports_anchors ( ) )
447
- {
450
+ let sequence = if descriptor. needs_csv_1_for_spend ( ) {
448
451
Sequence :: from_consensus ( 1 )
449
452
} else {
450
453
Sequence :: ZERO
0 commit comments