@@ -26,7 +26,7 @@ use crate::ln::chan_utils::{
2626use crate :: ln:: features:: ChannelTypeFeatures ;
2727use crate :: ln:: PaymentPreimage ;
2828use crate :: prelude:: * ;
29- use crate :: sign:: { EcdsaChannelSigner , SignerProvider , WriteableEcdsaChannelSigner } ;
29+ use crate :: sign:: { EcdsaChannelSigner , SignerProvider , WriteableEcdsaChannelSigner , P2WPKH_WITNESS_WEIGHT } ;
3030use crate :: sync:: Mutex ;
3131use crate :: util:: logger:: Logger ;
3232
@@ -384,12 +384,6 @@ pub struct Utxo {
384384}
385385
386386impl Utxo {
387- const P2WPKH_WITNESS_WEIGHT : u64 = 1 /* num stack items */ +
388- 1 /* sig length */ +
389- 73 /* sig including sighash flag */ +
390- 1 /* pubkey length */ +
391- 33 /* pubkey */ ;
392-
393387 /// Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output.
394388 pub fn new_p2pkh ( outpoint : OutPoint , value : u64 , pubkey_hash : & PubkeyHash ) -> Self {
395389 let script_sig_size = 1 /* script_sig length */ +
@@ -419,7 +413,7 @@ impl Utxo {
419413 value,
420414 script_pubkey : Script :: new_p2sh ( & Script :: new_v0_p2wpkh ( pubkey_hash) . script_hash ( ) ) ,
421415 } ,
422- satisfaction_weight : script_sig_size * WITNESS_SCALE_FACTOR as u64 + Self :: P2WPKH_WITNESS_WEIGHT ,
416+ satisfaction_weight : script_sig_size * WITNESS_SCALE_FACTOR as u64 + P2WPKH_WITNESS_WEIGHT ,
423417 }
424418 }
425419
@@ -431,7 +425,7 @@ impl Utxo {
431425 value,
432426 script_pubkey : Script :: new_v0_p2wpkh ( pubkey_hash) ,
433427 } ,
434- satisfaction_weight : EMPTY_SCRIPT_SIG_WEIGHT + Self :: P2WPKH_WITNESS_WEIGHT ,
428+ satisfaction_weight : EMPTY_SCRIPT_SIG_WEIGHT + P2WPKH_WITNESS_WEIGHT ,
435429 }
436430 }
437431}
0 commit comments