@@ -51,28 +51,28 @@ pub(crate) fn weight_revoked_offered_htlc(channel_type_features: &ChannelTypeFea
5151 // number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script
5252 const WEIGHT_REVOKED_OFFERED_HTLC : u64 = 1 + 1 + 73 + 1 + 33 + 1 + 133 ;
5353 const WEIGHT_REVOKED_OFFERED_HTLC_ANCHORS : u64 = WEIGHT_REVOKED_OFFERED_HTLC + 3 ; // + OP_1 + OP_CSV + OP_DROP
54- if channel_type_features. supports_anchors ( ) { WEIGHT_REVOKED_OFFERED_HTLC_ANCHORS } else { WEIGHT_REVOKED_OFFERED_HTLC }
54+ if channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) { WEIGHT_REVOKED_OFFERED_HTLC_ANCHORS } else { WEIGHT_REVOKED_OFFERED_HTLC }
5555}
5656
5757pub ( crate ) fn weight_revoked_received_htlc ( channel_type_features : & ChannelTypeFeatures ) -> u64 {
5858 // number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script
5959 const WEIGHT_REVOKED_RECEIVED_HTLC : u64 = 1 + 1 + 73 + 1 + 33 + 1 + 139 ;
6060 const WEIGHT_REVOKED_RECEIVED_HTLC_ANCHORS : u64 = WEIGHT_REVOKED_RECEIVED_HTLC + 3 ; // + OP_1 + OP_CSV + OP_DROP
61- if channel_type_features. supports_anchors ( ) { WEIGHT_REVOKED_RECEIVED_HTLC_ANCHORS } else { WEIGHT_REVOKED_RECEIVED_HTLC }
61+ if channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) { WEIGHT_REVOKED_RECEIVED_HTLC_ANCHORS } else { WEIGHT_REVOKED_RECEIVED_HTLC }
6262}
6363
6464pub ( crate ) fn weight_offered_htlc ( channel_type_features : & ChannelTypeFeatures ) -> u64 {
6565 // number_of_witness_elements + sig_length + counterpartyhtlc_sig + preimage_length + preimage + witness_script_length + witness_script
6666 const WEIGHT_OFFERED_HTLC : u64 = 1 + 1 + 73 + 1 + 32 + 1 + 133 ;
6767 const WEIGHT_OFFERED_HTLC_ANCHORS : u64 = WEIGHT_OFFERED_HTLC + 3 ; // + OP_1 + OP_CSV + OP_DROP
68- if channel_type_features. supports_anchors ( ) { WEIGHT_OFFERED_HTLC_ANCHORS } else { WEIGHT_OFFERED_HTLC }
68+ if channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) { WEIGHT_OFFERED_HTLC_ANCHORS } else { WEIGHT_OFFERED_HTLC }
6969}
7070
7171pub ( crate ) fn weight_received_htlc ( channel_type_features : & ChannelTypeFeatures ) -> u64 {
7272 // number_of_witness_elements + sig_length + counterpartyhtlc_sig + empty_vec_length + empty_vec + witness_script_length + witness_script
7373 const WEIGHT_RECEIVED_HTLC : u64 = 1 + 1 + 73 + 1 + 1 + 1 + 139 ;
7474 const WEIGHT_RECEIVED_HTLC_ANCHORS : u64 = WEIGHT_RECEIVED_HTLC + 3 ; // + OP_1 + OP_CSV + OP_DROP
75- if channel_type_features. supports_anchors ( ) { WEIGHT_RECEIVED_HTLC_ANCHORS } else { WEIGHT_RECEIVED_HTLC }
75+ if channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) { WEIGHT_RECEIVED_HTLC_ANCHORS } else { WEIGHT_RECEIVED_HTLC }
7676}
7777
7878// number_of_witness_elements + sig_length + revocation_sig + true_length + op_true + witness_script_length + witness_script
@@ -454,11 +454,11 @@ impl PackageSolvingData {
454454 PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ref outp) => outp. htlc . amount_msat / 1000 ,
455455 PackageSolvingData :: CounterpartyReceivedHTLCOutput ( ref outp) => outp. htlc . amount_msat / 1000 ,
456456 PackageSolvingData :: HolderHTLCOutput ( ref outp) => {
457- debug_assert ! ( outp. channel_type_features. supports_anchors ( ) ) ;
457+ debug_assert ! ( outp. channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) ) ;
458458 outp. amount_msat / 1000
459459 } ,
460460 PackageSolvingData :: HolderFundingOutput ( ref outp) => {
461- debug_assert ! ( outp. channel_type_features. supports_anchors ( ) ) ;
461+ debug_assert ! ( outp. channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) ) ;
462462 outp. funding_amount . unwrap ( )
463463 }
464464 } ;
@@ -471,7 +471,7 @@ impl PackageSolvingData {
471471 PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ref outp) => weight_offered_htlc ( & outp. channel_type_features ) as usize ,
472472 PackageSolvingData :: CounterpartyReceivedHTLCOutput ( ref outp) => weight_received_htlc ( & outp. channel_type_features ) as usize ,
473473 PackageSolvingData :: HolderHTLCOutput ( ref outp) => {
474- debug_assert ! ( outp. channel_type_features. supports_anchors ( ) ) ;
474+ debug_assert ! ( outp. channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) ) ;
475475 if outp. preimage . is_none ( ) {
476476 weight_offered_htlc ( & outp. channel_type_features ) as usize
477477 } else {
@@ -560,7 +560,7 @@ impl PackageSolvingData {
560560 fn get_finalized_tx < Signer : WriteableEcdsaChannelSigner > ( & self , outpoint : & BitcoinOutPoint , onchain_handler : & mut OnchainTxHandler < Signer > ) -> Option < Transaction > {
561561 match self {
562562 PackageSolvingData :: HolderHTLCOutput ( ref outp) => {
563- debug_assert ! ( !outp. channel_type_features. supports_anchors ( ) ) ;
563+ debug_assert ! ( !outp. channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) ) ;
564564 return onchain_handler. get_fully_signed_htlc_tx ( outpoint, & outp. preimage ) ;
565565 }
566566 PackageSolvingData :: HolderFundingOutput ( ref outp) => {
@@ -598,7 +598,7 @@ impl PackageSolvingData {
598598 PackageSolvingData :: RevokedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
599599 PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
600600 PackageSolvingData :: CounterpartyReceivedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , false ) } ,
601- PackageSolvingData :: HolderHTLCOutput ( ref outp) => if outp. channel_type_features . supports_anchors ( ) {
601+ PackageSolvingData :: HolderHTLCOutput ( ref outp) => if outp. channel_type_features . supports_anchors_zero_fee_htlc_tx ( ) {
602602 ( PackageMalleability :: Malleable , outp. preimage . is_some ( ) )
603603 } else {
604604 ( PackageMalleability :: Untractable , false )
@@ -823,7 +823,7 @@ impl PackageTemplate {
823823 for ( previous_output, input) in & self . inputs {
824824 match input {
825825 PackageSolvingData :: HolderHTLCOutput ( ref outp) => {
826- debug_assert ! ( outp. channel_type_features. supports_anchors ( ) ) ;
826+ debug_assert ! ( outp. channel_type_features. supports_anchors_zero_fee_htlc_tx ( ) ) ;
827827 onchain_handler. generate_external_htlc_claim ( & previous_output, & outp. preimage ) . map ( |htlc| {
828828 htlcs. get_or_insert_with ( || Vec :: with_capacity ( self . inputs . len ( ) ) ) . push ( htlc) ;
829829 } ) ;
@@ -947,8 +947,8 @@ impl PackageTemplate {
947947 /// attached to help the spending transaction reach confirmation.
948948 pub ( crate ) fn requires_external_funding ( & self ) -> bool {
949949 self . inputs . iter ( ) . find ( |input| match input. 1 {
950- PackageSolvingData :: HolderFundingOutput ( ref outp) => outp. channel_type_features . supports_anchors ( ) ,
951- PackageSolvingData :: HolderHTLCOutput ( ref outp) => outp. channel_type_features . supports_anchors ( ) ,
950+ PackageSolvingData :: HolderFundingOutput ( ref outp) => outp. channel_type_features . supports_anchors_zero_fee_htlc_tx ( ) ,
951+ PackageSolvingData :: HolderHTLCOutput ( ref outp) => outp. channel_type_features . supports_anchors_zero_fee_htlc_tx ( ) ,
952952 _ => false ,
953953 } ) . is_some ( )
954954 }
0 commit comments