@@ -51,28 +51,28 @@ pub(crate) fn weight_revoked_offered_htlc(channel_type_features: &ChannelTypeFea
51
51
// number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script
52
52
const WEIGHT_REVOKED_OFFERED_HTLC : u64 = 1 + 1 + 73 + 1 + 33 + 1 + 133 ;
53
53
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 }
55
55
}
56
56
57
57
pub ( crate ) fn weight_revoked_received_htlc ( channel_type_features : & ChannelTypeFeatures ) -> u64 {
58
58
// number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script
59
59
const WEIGHT_REVOKED_RECEIVED_HTLC : u64 = 1 + 1 + 73 + 1 + 33 + 1 + 139 ;
60
60
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 }
62
62
}
63
63
64
64
pub ( crate ) fn weight_offered_htlc ( channel_type_features : & ChannelTypeFeatures ) -> u64 {
65
65
// number_of_witness_elements + sig_length + counterpartyhtlc_sig + preimage_length + preimage + witness_script_length + witness_script
66
66
const WEIGHT_OFFERED_HTLC : u64 = 1 + 1 + 73 + 1 + 32 + 1 + 133 ;
67
67
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 }
69
69
}
70
70
71
71
pub ( crate ) fn weight_received_htlc ( channel_type_features : & ChannelTypeFeatures ) -> u64 {
72
72
// number_of_witness_elements + sig_length + counterpartyhtlc_sig + empty_vec_length + empty_vec + witness_script_length + witness_script
73
73
const WEIGHT_RECEIVED_HTLC : u64 = 1 + 1 + 73 + 1 + 1 + 1 + 139 ;
74
74
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 }
76
76
}
77
77
78
78
// number_of_witness_elements + sig_length + revocation_sig + true_length + op_true + witness_script_length + witness_script
@@ -454,11 +454,11 @@ impl PackageSolvingData {
454
454
PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ref outp) => outp. htlc . amount_msat / 1000 ,
455
455
PackageSolvingData :: CounterpartyReceivedHTLCOutput ( ref outp) => outp. htlc . amount_msat / 1000 ,
456
456
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 ( ) ) ;
458
458
outp. amount_msat / 1000
459
459
} ,
460
460
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 ( ) ) ;
462
462
outp. funding_amount . unwrap ( )
463
463
}
464
464
} ;
@@ -471,7 +471,7 @@ impl PackageSolvingData {
471
471
PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ref outp) => weight_offered_htlc ( & outp. channel_type_features ) as usize ,
472
472
PackageSolvingData :: CounterpartyReceivedHTLCOutput ( ref outp) => weight_received_htlc ( & outp. channel_type_features ) as usize ,
473
473
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 ( ) ) ;
475
475
if outp. preimage . is_none ( ) {
476
476
weight_offered_htlc ( & outp. channel_type_features ) as usize
477
477
} else {
@@ -560,7 +560,7 @@ impl PackageSolvingData {
560
560
fn get_finalized_tx < Signer : WriteableEcdsaChannelSigner > ( & self , outpoint : & BitcoinOutPoint , onchain_handler : & mut OnchainTxHandler < Signer > ) -> Option < Transaction > {
561
561
match self {
562
562
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 ( ) ) ;
564
564
return onchain_handler. get_fully_signed_htlc_tx ( outpoint, & outp. preimage ) ;
565
565
}
566
566
PackageSolvingData :: HolderFundingOutput ( ref outp) => {
@@ -598,7 +598,7 @@ impl PackageSolvingData {
598
598
PackageSolvingData :: RevokedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
599
599
PackageSolvingData :: CounterpartyOfferedHTLCOutput ( ..) => { ( PackageMalleability :: Malleable , true ) } ,
600
600
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 ( ) {
602
602
( PackageMalleability :: Malleable , outp. preimage . is_some ( ) )
603
603
} else {
604
604
( PackageMalleability :: Untractable , false )
@@ -823,7 +823,7 @@ impl PackageTemplate {
823
823
for ( previous_output, input) in & self . inputs {
824
824
match input {
825
825
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 ( ) ) ;
827
827
onchain_handler. generate_external_htlc_claim ( & previous_output, & outp. preimage ) . map ( |htlc| {
828
828
htlcs. get_or_insert_with ( || Vec :: with_capacity ( self . inputs . len ( ) ) ) . push ( htlc) ;
829
829
} ) ;
@@ -947,8 +947,8 @@ impl PackageTemplate {
947
947
/// attached to help the spending transaction reach confirmation.
948
948
pub ( crate ) fn requires_external_funding ( & self ) -> bool {
949
949
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 ( ) ,
952
952
_ => false ,
953
953
} ) . is_some ( )
954
954
}
0 commit comments