@@ -38,10 +38,10 @@ use crate::BlockHash;
3838use crate :: transaction:: SighashTypeParseError ;
3939/// Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
4040#[ derive( Debug ) ]
41- pub struct SigHashCache < T : Deref < Target = Transaction > > {
41+ pub struct SighashCache < T : Deref < Target = Transaction > > {
4242 /// Access to transaction required for various introspection, moreover type
4343 /// `T: Deref<Target=Transaction>` allows to accept borrow and mutable borrow, the
44- /// latter in particular is necessary for [`SigHashCache ::witness_mut`]
44+ /// latter in particular is necessary for [`SighashCache ::witness_mut`]
4545 tx : T ,
4646
4747 /// Common cache for taproot and segwit inputs. It's an option because it's not needed for legacy inputs
@@ -232,13 +232,13 @@ impl<'s> From<ScriptPath<'s>> for TapLeafHash {
232232 }
233233}
234234
235- impl < R : Deref < Target = Transaction > > SigHashCache < R > {
235+ impl < R : Deref < Target = Transaction > > SighashCache < R > {
236236 /// Compute the sighash components from an unsigned transaction and auxiliary
237237 /// in a lazy manner when required.
238238 /// For the generated sighashes to be valid, no fields in the transaction may change except for
239239 /// script_sig and witnesses.
240240 pub fn new ( tx : R ) -> Self {
241- SigHashCache {
241+ SighashCache {
242242 tx,
243243 common_cache : None ,
244244 taproot_cache : None ,
@@ -468,7 +468,7 @@ impl<R: Deref<Target = Transaction>> SigHashCache<R> {
468468 /// Compute the BIP341 sighash for a script spend
469469 ///
470470 /// Assumes the default `OP_CODESEPARATOR` position of `0xFFFFFFFF`. Custom values can be
471- /// provided through the more fine-grained API of [`SigHashCache ::taproot_encode_signing_data_to`].
471+ /// provided through the more fine-grained API of [`SighashCache ::taproot_encode_signing_data_to`].
472472 pub fn taproot_script_spend_signature_hash < S : Into < TapLeafHash > , T : Borrow < TxOut > > (
473473 & mut self ,
474474 input_index : usize ,
@@ -813,21 +813,21 @@ impl<R: Deref<Target = Transaction>> SigHashCache<R> {
813813 }
814814}
815815
816- impl < R : DerefMut < Target = Transaction > > SigHashCache < R > {
817- /// When the SigHashCache is initialized with a mutable reference to a transaction instead of a
816+ impl < R : DerefMut < Target = Transaction > > SighashCache < R > {
817+ /// When the SighashCache is initialized with a mutable reference to a transaction instead of a
818818 /// regular reference, this method is available to allow modification to the witnesses.
819819 ///
820820 /// This allows in-line signing such as
821821 /// ```
822822 /// use elements::{LockTime, Transaction, EcdsaSigHashType};
823- /// use elements::sighash::SigHashCache ;
823+ /// use elements::sighash::SighashCache ;
824824 /// use elements::Script;
825825 /// use elements::confidential;
826826 ///
827827 /// let mut tx_to_sign = Transaction { version: 2, lock_time: LockTime::ZERO, input: Vec::new(), output: Vec::new() };
828828 /// let input_count = tx_to_sign.input.len();
829829 ///
830- /// let mut sig_hasher = SigHashCache ::new(&mut tx_to_sign);
830+ /// let mut sig_hasher = SighashCache ::new(&mut tx_to_sign);
831831 /// for inp in 0..input_count {
832832 /// let prevout_script = Script::new();
833833 /// let _sighash = sig_hasher.segwitv0_sighash(inp, &prevout_script, confidential::Value::Explicit(42), EcdsaSigHashType::All);
@@ -979,7 +979,7 @@ mod tests{
979979 let raw_expected = crate :: hashes:: sha256:: Hash :: from_str ( expected_result) . unwrap ( ) ;
980980 let expected_result = SigHash :: from_slice ( & raw_expected[ ..] ) . unwrap ( ) ;
981981
982- let mut cache = SigHashCache :: new ( & tx) ;
982+ let mut cache = SighashCache :: new ( & tx) ;
983983 let value : confidential:: Value = deserialize ( & Vec :: < u8 > :: from_hex ( value) . unwrap ( ) [ ..] ) . unwrap ( ) ;
984984 let actual_result = cache. segwitv0_sighash ( input_index, & script, value, hash_type) ;
985985 assert_eq ! ( actual_result, expected_result) ;
@@ -1012,7 +1012,7 @@ mod tests{
10121012 // A hack to parse sha256d strings are sha256 so that we don't reverse them...
10131013 let raw_expected = crate :: hashes:: sha256:: Hash :: from_str ( expected_result) . unwrap ( ) ;
10141014 let expected_result = SigHash :: from_slice ( & raw_expected[ ..] ) . unwrap ( ) ;
1015- let sighash_cache = SigHashCache :: new ( & tx) ;
1015+ let sighash_cache = SighashCache :: new ( & tx) ;
10161016 let actual_result = sighash_cache. legacy_sighash ( input_index, & script, hash_type) ;
10171017 assert_eq ! ( actual_result, expected_result) ;
10181018 }
0 commit comments