@@ -72,7 +72,7 @@ const P2WPKH_INPUT_WEIGHT: u64 = (36 + 4 + 1) * WITNESS_SCALE_FACTOR as u64 + (1
7272// - 22 bytes for the script (OP_0 OP_PUSH20 20 byte public key hash)
7373const P2WPKH_OUTPUT_WEIGHT : u64 = ( 8 + 1 + 22 ) * WITNESS_SCALE_FACTOR as u64 ;
7474
75- // A P2TR input consists of:
75+ // A P2TR key path input consists of:
7676// - 36 bytes for the previous outpoint:
7777// - 32 bytes transaction hash
7878// - 4 bytes index
@@ -82,7 +82,7 @@ const P2WPKH_OUTPUT_WEIGHT: u64 = (8 + 1 + 22) * WITNESS_SCALE_FACTOR as u64;
8282// - 1 byte for witness items count
8383// - 1 byte for the signature length
8484// - 64 bytes for the Schnorr signature
85- const P2TR_INPUT_WEIGHT : u64 = ( 36 + 4 + 1 ) * WITNESS_SCALE_FACTOR as u64 + ( 1 + 1 + 64 ) ;
85+ const P2TR_KEYPATH_INPUT_WEIGHT : u64 = ( 36 + 4 + 1 ) * WITNESS_SCALE_FACTOR as u64 + ( 1 + 1 + 64 ) ;
8686// A P2TR output consists of:
8787// - 8 bytes for the output amount
8888// - 1 byte for the script length
@@ -109,7 +109,7 @@ const ANCHOR_INPUT_WEIGHT: u64 = (36 + 4 + 1) * WITNESS_SCALE_FACTOR as u64 + (1
109109fn htlc_success_transaction_weight ( context : & AnchorChannelReserveContext ) -> u64 {
110110 PER_HTLC_SUCCESS_WEIGHT
111111 + if context. taproot_wallet {
112- P2TR_INPUT_WEIGHT + P2TR_OUTPUT_WEIGHT
112+ P2TR_KEYPATH_INPUT_WEIGHT + P2TR_OUTPUT_WEIGHT
113113 } else {
114114 P2WPKH_INPUT_WEIGHT + P2WPKH_OUTPUT_WEIGHT
115115 }
@@ -118,7 +118,7 @@ fn htlc_success_transaction_weight(context: &AnchorChannelReserveContext) -> u64
118118fn htlc_timeout_transaction_weight ( context : & AnchorChannelReserveContext ) -> u64 {
119119 PER_HTLC_TIMEOUT_WEIGHT
120120 + if context. taproot_wallet {
121- P2TR_INPUT_WEIGHT + P2TR_OUTPUT_WEIGHT
121+ P2TR_KEYPATH_INPUT_WEIGHT + P2TR_OUTPUT_WEIGHT
122122 } else {
123123 P2WPKH_INPUT_WEIGHT + P2WPKH_OUTPUT_WEIGHT
124124 }
@@ -209,7 +209,7 @@ pub fn get_reserve_per_channel(context: &AnchorChannelReserveContext) -> Amount
209209 get_reserve_per_channel_with_input (
210210 context,
211211 if context. taproot_wallet {
212- Weight :: from_wu ( P2TR_INPUT_WEIGHT )
212+ Weight :: from_wu ( P2TR_KEYPATH_INPUT_WEIGHT )
213213 } else {
214214 Weight :: from_wu ( P2WPKH_INPUT_WEIGHT )
215215 } ,
@@ -378,7 +378,7 @@ mod test {
378378 assert_eq ! (
379379 anchor_output_spend_transaction_weight(
380380 & AnchorChannelReserveContext { taproot_wallet: true , ..Default :: default ( ) } ,
381- Weight :: from_wu( P2TR_INPUT_WEIGHT ) ,
381+ Weight :: from_wu( P2TR_KEYPATH_INPUT_WEIGHT ) ,
382382 ) ,
383383 723
384384 ) ;
0 commit comments