pub fn max_satisfaction_weight(&self) -> usize {
        fn varint_len(n: usize) -> usize {
            bitcoin::VarInt(n as u64).len()
        }

        match *self {
            Descriptor::Bare(ref ms) => {
                let scriptsig_len = ms.max_satisfaction_size(1);
                4 * (varint_len(scriptsig_len) + scriptsig_len)
            }
            Descriptor::Pk(..) => 4 * (1 + 73),
            Descriptor::Pkh(ref pk) => 4 * (1 + 73 + pk.serialized_len()),
            Descriptor::Wpkh(ref pk) => 4 + 1 + 73 + pk.serialized_len(),
            Descriptor::ShWpkh(ref pk) => 4 * 24 + 1 + 73 + pk.serialized_len(),
            Descriptor::Sh(ref ms) => {
                let ss = ms.script_size();
                let push_size = if ss < 76 {
                    1
                } else if ss < 0x100 {
                    2
                } else if ss < 0x10000 {
                    3
                } else {
                    5
                };

                let scriptsig_len = push_size + ss + ms.max_satisfaction_size(1);
                4 * (varint_len(scriptsig_len) + scriptsig_len)
            }
            Descriptor::Wsh(ref ms) => {
                let script_size = ms.script_size();
                4 +  // scriptSig length byte
                    varint_len(script_size) +
                    script_size +
                    varint_len(ms.max_satisfaction_witness_elements()) +
                    ms.max_satisfaction_size(2)
            }
            Descriptor::ShWsh(ref ms) => {
                let script_size = ms.script_size();
                4 * 36
                    + varint_len(script_size)
                    + script_size
                    + varint_len(ms.max_satisfaction_witness_elements())
                    + ms.max_satisfaction_size(2)
            }
            Descriptor::Cov(ref cov) => {
                let script_size = cov.commit_ctx.script_pubkey().len();
                4 * 36 + varint_len(script_size) + script_size + varint_len(11) + 700
            }
        }
    }
/// Computes an upper bound on the weight of a satisfying witness to the
/// transaction. Assumes all signatures are 73 bytes, including push opcode
/// and sighash suffix. Includes the weight of the VarInts encoding the
/// scriptSig and witness stack length.
Computes an upper bound on the weight of a satisfying witness to the
transaction. Assumes all signatures are 73 bytes, including push opcode
and sighash suffix. Includes the weight of the VarInts encoding the
scriptSig and witness stack length.
Computes an upper bound on the weight of a satisfying witness to the transaction . Assumes all signatures are 73 bytes including push opcode and sighash suffix . Includes the weight of the VarInts encoding the scriptSig and witness stack length .
pub fn max_satisfaction_weight(&self) -> usize {
        fn varint_len(n: usize) -> usize {
            bitcoin::VarInt(n as u64).len()
        }
        match *self {
            Descriptor::Bare(ref ms) => {
                let scriptsig_len = ms.max_satisfaction_size(1);
                4 * (varint_len(scriptsig_len) + scriptsig_len)
            }
            Descriptor::Pk(..) => 4 * (1 + 73),
            Descriptor::Pkh(ref pk) => 4 * (1 + 73 + pk.serialized_len()),
            Descriptor::Wpkh(ref pk) => 4 + 1 + 73 + pk.serialized_len(),
            Descriptor::ShWpkh(ref pk) => 4 * 24 + 1 + 73 + pk.serialized_len(),
            Descriptor::Sh(ref ms) => {
                let ss = ms.script_size();
                let push_size = if ss < 76 {
                    1
                } else if ss < 0x100 {
                    2
                } else if ss < 0x10000 {
                    3
                } else {
                    5
                };
                let scriptsig_len = push_size + ss + ms.max_satisfaction_size(1);
                4 * (varint_len(scriptsig_len) + scriptsig_len)
            }
            Descriptor::Wsh(ref ms) => {
                let script_size = ms.script_size();
                4 +  // scriptSig length byte
                    varint_len(script_size) +
                    script_size +
                    varint_len(ms.max_satisfaction_witness_elements()) +
                    ms.max_satisfaction_size(2)
            }
            Descriptor::ShWsh(ref ms) => {
                let script_size = ms.script_size();
                4 * 36
                    + varint_len(script_size)
                    + script_size
                    + varint_len(ms.max_satisfaction_witness_elements())
                    + ms.max_satisfaction_size(2)
            }
            Descriptor::Cov(ref cov) => {
                let script_size = cov.commit_ctx.script_pubkey().len();
                4 * 36 + varint_len(script_size) + script_size + varint_len(11) + 700
            }
        }
    }
pub fn max_satisfaction_weight ( & self ) -> usize { fn varint_len ( n : usize ) -> usize { bitcoin :: VarInt ( n as u64 ) . len ( ) } match * self { Descriptor :: Bare ( ref ms ) => { let scriptsig_len = ms . max_satisfaction_size ( 1 ) ; 4 * ( varint_len ( scriptsig_len ) + scriptsig_len ) } Descriptor :: Pk ( .. ) => 4 * ( 1 + 73 ) , Descriptor :: Pkh ( ref pk ) => 4 * ( 1 + 73 + pk . serialized_len ( ) ) , Descriptor :: Wpkh ( ref pk ) => 4 + 1 + 73 + pk . serialized_len ( ) , Descriptor :: ShWpkh ( ref pk ) => 4 * 24 + 1 + 73 + pk . serialized_len ( ) , Descriptor :: Sh ( ref ms ) => { let ss = ms . script_size ( ) ; let push_size = if ss < 76 { 1 } else if ss < 0x100 { 2 } else if ss < 0x10000 { 3 } else { 5 } ; let scriptsig_len = push_size + ss + ms . max_satisfaction_size ( 1 ) ; 4 * ( varint_len ( scriptsig_len ) + scriptsig_len ) } Descriptor :: Wsh ( ref ms ) => { let script_size = ms . script_size ( ) ; 4 + // scriptSig length byte varint_len ( script_size ) + script_size + varint_len ( ms . max_satisfaction_witness_elements ( ) ) + ms . max_satisfaction_size ( 2 ) } Descriptor :: ShWsh ( ref ms ) => { let script_size = ms . script_size ( ) ; 4 * 36 + varint_len ( script_size ) + script_size + varint_len ( ms . max_satisfaction_witness_elements ( ) ) + ms . max_satisfaction_size ( 2 ) } Descriptor :: Cov ( ref cov ) => { let script_size = cov . commit_ctx . script_pubkey ( ) . len ( ) ; 4 * 36 + varint_len ( script_size ) + script_size + varint_len ( 11 ) + 700 } } }
Computes an upper bound on the weight of a satisfying witness to the
transaction.
Computes an upper bound on the weight of a satisfying witness to the transaction .
&self
&self