@@ -86,7 +86,7 @@ struct TaprootCache {
8686}
8787
8888/// Contains outputs of previous transactions.
89- /// In the case [`SchnorrSigHashType `] variant is `ANYONECANPAY`, [`Prevouts::One`] may be provided
89+ /// In the case [`SchnorrSighashType `] variant is `ANYONECANPAY`, [`Prevouts::One`] may be provided
9090#[ derive( Clone , PartialEq , Eq , Hash , Debug ) ]
9191pub enum Prevouts < ' u , T > where T : ' u + Borrow < TxOut > {
9292 /// `One` variant allows to provide the single Prevout needed. It's useful for example
@@ -256,7 +256,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
256256 prevouts : & Prevouts < T > ,
257257 annex : Option < Annex > ,
258258 leaf_hash_code_separator : Option < ( TapLeafHash , u32 ) > ,
259- sighash_type : SchnorrSigHashType ,
259+ sighash_type : SchnorrSighashType ,
260260 genesis_hash : BlockHash ,
261261 ) -> Result < ( ) , Error > {
262262 prevouts. check_all ( & self . tx ) ?;
@@ -313,7 +313,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
313313 // If hash_type & 3 does not equal SIGHASH_NONE or SIGHASH_SINGLE:
314314 // sha_outputs (32): the SHA256 of the serialization of all outputs in CTxOut format.
315315 // sha_output_witnesses (32): (ELEMENTS) the SHA256 of the serialization of all output witnesses
316- if sighash != SchnorrSigHashType :: None && sighash != SchnorrSigHashType :: Single {
316+ if sighash != SchnorrSighashType :: None && sighash != SchnorrSighashType :: Single {
317317 self . common_cache ( ) . outputs . consensus_encode ( & mut writer) ?;
318318 self . taproot_cache ( prevouts. get_all ( ) ?)
319319 . output_witnesses
@@ -388,7 +388,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
388388 // If hash_type & 3 equals SIGHASH_SINGLE:
389389 // sha_single_output (32): the SHA256 of the corresponding output in CTxOut format.
390390 // sha_single_output_witness (32): the sha256 serialization of output witnesses
391- if sighash == SchnorrSigHashType :: Single {
391+ if sighash == SchnorrSighashType :: Single {
392392 let mut enc = sha256:: Hash :: engine ( ) ;
393393 let out = self . tx
394394 . output
@@ -428,7 +428,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
428428 prevouts : & Prevouts < T > ,
429429 annex : Option < Annex > ,
430430 leaf_hash_code_separator : Option < ( TapLeafHash , u32 ) > ,
431- sighash_type : SchnorrSigHashType ,
431+ sighash_type : SchnorrSighashType ,
432432 genesis_hash : BlockHash ,
433433 ) -> Result < TapSighashHash , Error > {
434434 let mut enc = TapSighashHash :: engine ( ) ;
@@ -449,7 +449,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
449449 & mut self ,
450450 input_index : usize ,
451451 prevouts : & Prevouts < T > ,
452- sighash_type : SchnorrSigHashType ,
452+ sighash_type : SchnorrSighashType ,
453453 genesis_hash : BlockHash ,
454454 ) -> Result < TapSighashHash , Error > {
455455 let mut enc = TapSighashHash :: engine ( ) ;
@@ -474,7 +474,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
474474 input_index : usize ,
475475 prevouts : & Prevouts < T > ,
476476 leaf_hash : S ,
477- sighash_type : SchnorrSigHashType ,
477+ sighash_type : SchnorrSighashType ,
478478 genesis_hash : BlockHash ,
479479 ) -> Result < TapSighashHash , Error > {
480480 let mut enc = TapSighashHash :: engine ( ) ;
@@ -875,8 +875,8 @@ impl<'a> Encodable for Annex<'a> {
875875/// Hashtype of an input's signature, encoded in the last byte of the signature
876876/// Fixed values so they can be casted as integer types for encoding
877877#[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Debug ) ]
878- pub enum SchnorrSigHashType {
879- /// 0x0: Used when not explicitly specified, defaulting to [`SchnorrSigHashType ::All`]
878+ pub enum SchnorrSighashType {
879+ /// 0x0: Used when not explicitly specified, defaulting to [`SchnorrSighashType ::All`]
880880 Default = 0x00 ,
881881 /// 0x1: Sign all outputs
882882 All = 0x01 ,
@@ -898,67 +898,67 @@ pub enum SchnorrSigHashType {
898898 Reserved = 0xFF ,
899899}
900900
901- serde_string_impl ! ( SchnorrSigHashType , "a SchnorrSigHashType data" ) ;
901+ serde_string_impl ! ( SchnorrSighashType , "a SchnorrSighashType data" ) ;
902902
903- impl SchnorrSigHashType {
903+ impl SchnorrSighashType {
904904 /// Break the sighash flag into the "real" sighash flag and the ANYONECANPAY boolean
905- pub fn split_anyonecanpay_flag ( self ) -> ( SchnorrSigHashType , bool ) {
905+ pub fn split_anyonecanpay_flag ( self ) -> ( SchnorrSighashType , bool ) {
906906 match self {
907- SchnorrSigHashType :: Default => ( SchnorrSigHashType :: Default , false ) ,
908- SchnorrSigHashType :: All => ( SchnorrSigHashType :: All , false ) ,
909- SchnorrSigHashType :: None => ( SchnorrSigHashType :: None , false ) ,
910- SchnorrSigHashType :: Single => ( SchnorrSigHashType :: Single , false ) ,
911- SchnorrSigHashType :: AllPlusAnyoneCanPay => ( SchnorrSigHashType :: All , true ) ,
912- SchnorrSigHashType :: NonePlusAnyoneCanPay => ( SchnorrSigHashType :: None , true ) ,
913- SchnorrSigHashType :: SinglePlusAnyoneCanPay => ( SchnorrSigHashType :: Single , true ) ,
914- SchnorrSigHashType :: Reserved => ( SchnorrSigHashType :: Reserved , false ) ,
907+ SchnorrSighashType :: Default => ( SchnorrSighashType :: Default , false ) ,
908+ SchnorrSighashType :: All => ( SchnorrSighashType :: All , false ) ,
909+ SchnorrSighashType :: None => ( SchnorrSighashType :: None , false ) ,
910+ SchnorrSighashType :: Single => ( SchnorrSighashType :: Single , false ) ,
911+ SchnorrSighashType :: AllPlusAnyoneCanPay => ( SchnorrSighashType :: All , true ) ,
912+ SchnorrSighashType :: NonePlusAnyoneCanPay => ( SchnorrSighashType :: None , true ) ,
913+ SchnorrSighashType :: SinglePlusAnyoneCanPay => ( SchnorrSighashType :: Single , true ) ,
914+ SchnorrSighashType :: Reserved => ( SchnorrSighashType :: Reserved , false ) ,
915915 }
916916 }
917917
918- /// Create a [`SchnorrSigHashType `] from raw u8
918+ /// Create a [`SchnorrSighashType `] from raw u8
919919 pub fn from_u8 ( hash_ty : u8 ) -> Option < Self > {
920920 match hash_ty {
921- 0x00 => Some ( SchnorrSigHashType :: Default ) ,
922- 0x01 => Some ( SchnorrSigHashType :: All ) ,
923- 0x02 => Some ( SchnorrSigHashType :: None ) ,
924- 0x03 => Some ( SchnorrSigHashType :: Single ) ,
925- 0x81 => Some ( SchnorrSigHashType :: AllPlusAnyoneCanPay ) ,
926- 0x82 => Some ( SchnorrSigHashType :: NonePlusAnyoneCanPay ) ,
927- 0x83 => Some ( SchnorrSigHashType :: SinglePlusAnyoneCanPay ) ,
921+ 0x00 => Some ( SchnorrSighashType :: Default ) ,
922+ 0x01 => Some ( SchnorrSighashType :: All ) ,
923+ 0x02 => Some ( SchnorrSighashType :: None ) ,
924+ 0x03 => Some ( SchnorrSighashType :: Single ) ,
925+ 0x81 => Some ( SchnorrSighashType :: AllPlusAnyoneCanPay ) ,
926+ 0x82 => Some ( SchnorrSighashType :: NonePlusAnyoneCanPay ) ,
927+ 0x83 => Some ( SchnorrSighashType :: SinglePlusAnyoneCanPay ) ,
928928 _x => None ,
929929 }
930930 }
931931}
932932
933- impl fmt:: Display for SchnorrSigHashType {
933+ impl fmt:: Display for SchnorrSighashType {
934934 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
935935 let s = match self {
936- SchnorrSigHashType :: Default => "SIGHASH_DEFAULT" ,
937- SchnorrSigHashType :: All => "SIGHASH_ALL" ,
938- SchnorrSigHashType :: None => "SIGHASH_NONE" ,
939- SchnorrSigHashType :: Single => "SIGHASH_SINGLE" ,
940- SchnorrSigHashType :: AllPlusAnyoneCanPay => "SIGHASH_ALL|SIGHASH_ANYONECANPAY" ,
941- SchnorrSigHashType :: NonePlusAnyoneCanPay => "SIGHASH_NONE|SIGHASH_ANYONECANPAY" ,
942- SchnorrSigHashType :: SinglePlusAnyoneCanPay => "SIGHASH_SINGLE|SIGHASH_ANYONECANPAY" ,
943- SchnorrSigHashType :: Reserved => "SIGHASH_RESERVED" ,
936+ SchnorrSighashType :: Default => "SIGHASH_DEFAULT" ,
937+ SchnorrSighashType :: All => "SIGHASH_ALL" ,
938+ SchnorrSighashType :: None => "SIGHASH_NONE" ,
939+ SchnorrSighashType :: Single => "SIGHASH_SINGLE" ,
940+ SchnorrSighashType :: AllPlusAnyoneCanPay => "SIGHASH_ALL|SIGHASH_ANYONECANPAY" ,
941+ SchnorrSighashType :: NonePlusAnyoneCanPay => "SIGHASH_NONE|SIGHASH_ANYONECANPAY" ,
942+ SchnorrSighashType :: SinglePlusAnyoneCanPay => "SIGHASH_SINGLE|SIGHASH_ANYONECANPAY" ,
943+ SchnorrSighashType :: Reserved => "SIGHASH_RESERVED" ,
944944 } ;
945945 f. write_str ( s)
946946 }
947947}
948948
949- impl std:: str:: FromStr for SchnorrSigHashType {
949+ impl std:: str:: FromStr for SchnorrSighashType {
950950 type Err = SighashTypeParseError ;
951951
952952 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
953953 match s {
954- "SIGHASH_DEFAULT" => Ok ( SchnorrSigHashType :: Default ) ,
955- "SIGHASH_ALL" => Ok ( SchnorrSigHashType :: All ) ,
956- "SIGHASH_NONE" => Ok ( SchnorrSigHashType :: None ) ,
957- "SIGHASH_SINGLE" => Ok ( SchnorrSigHashType :: Single ) ,
958- "SIGHASH_ALL|SIGHASH_ANYONECANPAY" => Ok ( SchnorrSigHashType :: AllPlusAnyoneCanPay ) ,
959- "SIGHASH_NONE|SIGHASH_ANYONECANPAY" => Ok ( SchnorrSigHashType :: NonePlusAnyoneCanPay ) ,
960- "SIGHASH_SINGLE|SIGHASH_ANYONECANPAY" => Ok ( SchnorrSigHashType :: SinglePlusAnyoneCanPay ) ,
961- "SIGHASH_RESERVED" => Ok ( SchnorrSigHashType :: Reserved ) ,
954+ "SIGHASH_DEFAULT" => Ok ( SchnorrSighashType :: Default ) ,
955+ "SIGHASH_ALL" => Ok ( SchnorrSighashType :: All ) ,
956+ "SIGHASH_NONE" => Ok ( SchnorrSighashType :: None ) ,
957+ "SIGHASH_SINGLE" => Ok ( SchnorrSighashType :: Single ) ,
958+ "SIGHASH_ALL|SIGHASH_ANYONECANPAY" => Ok ( SchnorrSighashType :: AllPlusAnyoneCanPay ) ,
959+ "SIGHASH_NONE|SIGHASH_ANYONECANPAY" => Ok ( SchnorrSighashType :: NonePlusAnyoneCanPay ) ,
960+ "SIGHASH_SINGLE|SIGHASH_ANYONECANPAY" => Ok ( SchnorrSighashType :: SinglePlusAnyoneCanPay ) ,
961+ "SIGHASH_RESERVED" => Ok ( SchnorrSighashType :: Reserved ) ,
962962 _ => Err ( SighashTypeParseError { unrecognized : s. to_owned ( ) } ) ,
963963 }
964964 }
0 commit comments