@@ -164,7 +164,7 @@ impl StaticPaymentOutputDescriptor {
164164 /// originated from an anchor outputs channel, as they take the form of a P2WSH script.
165165 pub fn witness_script ( & self ) -> Option < ScriptBuf > {
166166 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 ( ) {
168168 let payment_point = channel_params. holder_pubkeys . payment_point ;
169169 Some ( chan_utils:: get_to_countersignatory_with_anchors_redeemscript ( & payment_point) )
170170 } else {
@@ -177,7 +177,7 @@ impl StaticPaymentOutputDescriptor {
177177 /// Note: If you have the grind_signatures feature enabled, this will be at least 1 byte
178178 /// shorter.
179179 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 ( ) {
181181 let witness_script_weight = 1 /* pubkey push */ + 33 /* pubkey */ +
182182 1 /* OP_CHECKSIGVERIFY */ + 1 /* OP_1 */ + 1 /* OP_CHECKSEQUENCEVERIFY */ ;
183183 1 /* num witness items */ + 1 /* sig push */ + 73 /* sig including sighash flag */ +
@@ -186,6 +186,13 @@ impl StaticPaymentOutputDescriptor {
186186 P2WPKH_WITNESS_WEIGHT
187187 }
188188 }
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+ }
189196}
190197impl_writeable_tlv_based ! ( StaticPaymentOutputDescriptor , {
191198 ( 0 , outpoint, required) ,
@@ -440,11 +447,7 @@ impl SpendableOutputDescriptor {
440447 if !output_set. insert ( descriptor. outpoint ) {
441448 return Err ( ( ) ) ;
442449 }
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 ( ) {
448451 Sequence :: from_consensus ( 1 )
449452 } else {
450453 Sequence :: ZERO
0 commit comments