@@ -203,10 +203,7 @@ impl CounterpartyOfferedHTLCOutput {
203203
204204impl Writeable for CounterpartyOfferedHTLCOutput {
205205 fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
206- let mut channel_type_features = Some ( self . channel_type_features . clone ( ) ) ;
207- if !self . channel_type_features . supports_anchors ( ) {
208- channel_type_features = None ;
209- }
206+ let channel_type_features = self . channel_type_features . serializable_option ( ) ;
210207 write_tlv_fields ! ( writer, {
211208 ( 0 , self . per_commitment_point, required) ,
212209 ( 2 , self . counterparty_delayed_payment_base_key, required) ,
@@ -275,10 +272,7 @@ impl CounterpartyReceivedHTLCOutput {
275272
276273impl Writeable for CounterpartyReceivedHTLCOutput {
277274 fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
278- let mut channel_type_features = Some ( self . channel_type_features . clone ( ) ) ;
279- if !self . channel_type_features . supports_anchors ( ) {
280- channel_type_features = None ;
281- }
275+ let channel_type_features = self . channel_type_features . serializable_option ( ) ;
282276 write_tlv_fields ! ( writer, {
283277 ( 0 , self . per_commitment_point, required) ,
284278 ( 2 , self . counterparty_delayed_payment_base_key, required) ,
@@ -351,10 +345,7 @@ impl HolderHTLCOutput {
351345
352346impl Writeable for HolderHTLCOutput {
353347 fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
354- let mut channel_type_features = Some ( self . channel_type_features . clone ( ) ) ;
355- if !self . channel_type_features . supports_anchors ( ) {
356- channel_type_features = None ;
357- }
348+ let channel_type_features = self . channel_type_features . serializable_option ( ) ;
358349 write_tlv_fields ! ( writer, {
359350 ( 0 , self . amount_msat, required) ,
360351 ( 2 , self . cltv_expiry, required) ,
@@ -411,10 +402,7 @@ impl HolderFundingOutput {
411402
412403impl Writeable for HolderFundingOutput {
413404 fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
414- let mut channel_type_features = Some ( self . channel_type_features . clone ( ) ) ;
415- if !self . channel_type_features . supports_anchors ( ) {
416- channel_type_features = None ;
417- }
405+ let channel_type_features = self . channel_type_features . serializable_option ( ) ;
418406 write_tlv_fields ! ( writer, {
419407 ( 0 , self . funding_redeemscript, required) ,
420408 ( 2 , channel_type_features, option) ,
0 commit comments