Skip to content

Commit bb7bddc

Browse files
committed
SigHash -> Sighash
1 parent 468b787 commit bb7bddc

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/hash_types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ hash_newtype! {
4444
pub struct BlockHash(sha256d::Hash);
4545

4646
/// "Hash of the transaction according to the signature algorithm"
47-
pub struct SigHash(sha256d::Hash);
47+
pub struct Sighash(sha256d::Hash);
4848

4949
/// A hash of a public key.
5050
pub struct PubkeyHash(hash160::Hash);
@@ -62,11 +62,11 @@ hash_newtype! {
6262

6363
impl_hashencode!(Txid);
6464
impl_hashencode!(Wtxid);
65-
impl_hashencode!(SigHash);
65+
impl_hashencode!(Sighash);
6666
impl_hashencode!(BlockHash);
6767
impl_hashencode!(TxMerkleNode);
6868

69-
impl ThirtyTwoByteHash for SigHash {
69+
impl ThirtyTwoByteHash for Sighash {
7070
fn into_32(self) -> [u8; 32] {
7171
self.0.to_byte_array()
7272
}

src/pset/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum Error {
6464
/// Actual
6565
actual: Txid,
6666
},
67-
/// Unable to parse as a standard SigHash type.
67+
/// Unable to parse as a standard Sighash type.
6868
NonStandardSighashType(u32),
6969
/// Parsing errors from bitcoin_hashes
7070
HashParseError(hashes::Error),

src/pset/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//!
1717
//! Implementation of BIP174 Partially Signed Bitcoin Transaction Format as
1818
//! defined at <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>
19-
//! except we define PSETs containing non-standard SigHash types as invalid.
19+
//! except we define PSETs containing non-standard Sighash types as invalid.
2020
//! Extension for PSET is based on PSET defined in BIP370.
2121
//! <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>
2222

src/sighash.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
2222
use std::borrow::Borrow;
2323
use crate::encode::{self, Encodable};
24-
use crate::hash_types::SigHash;
24+
use crate::hash_types::Sighash;
2525
use crate::hashes::{sha256d, Hash, sha256};
2626
use crate::script::Script;
2727
use std::ops::{Deref, DerefMut};
@@ -552,9 +552,9 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
552552
if sighash != EcdsaSighashType::Single && sighash != EcdsaSighashType::None {
553553
self.segwit_cache().outputs.consensus_encode(&mut writer)?;
554554
} else if sighash == EcdsaSighashType::Single && input_index < self.tx.output.len() {
555-
let mut single_enc = SigHash::engine();
555+
let mut single_enc = Sighash::engine();
556556
self.tx.output[input_index].consensus_encode(&mut single_enc)?;
557-
SigHash::from_engine(single_enc).consensus_encode(&mut writer)?;
557+
Sighash::from_engine(single_enc).consensus_encode(&mut writer)?;
558558
} else {
559559
zero_hash.consensus_encode(&mut writer)?;
560560
}
@@ -579,11 +579,11 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
579579
script_code: &Script,
580580
value: confidential::Value,
581581
sighash_type: EcdsaSighashType
582-
) -> SigHash {
583-
let mut enc = SigHash::engine();
582+
) -> Sighash {
583+
let mut enc = Sighash::engine();
584584
self.encode_segwitv0_signing_data_to(&mut enc, input_index, script_code, value, sighash_type)
585585
.expect("engines don't error");
586-
SigHash::from_engine(enc)
586+
Sighash::from_engine(enc)
587587
}
588588

589589
/// Encodes the signing data from which a signature hash for a given input index with a given
@@ -692,11 +692,11 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
692692
input_index: usize,
693693
script_pubkey: &Script,
694694
sighash_type: EcdsaSighashType,
695-
) -> SigHash {
696-
let mut engine = SigHash::engine();
695+
) -> Sighash {
696+
let mut engine = Sighash::engine();
697697
self.encode_legacy_signing_data_to(&mut engine, input_index, script_pubkey, sighash_type)
698698
.expect("engines don't error");
699-
SigHash::from_engine(engine)
699+
Sighash::from_engine(engine)
700700
}
701701

702702
#[inline]
@@ -977,7 +977,7 @@ mod tests{
977977
let script = Script::from(Vec::<u8>::from_hex(script).unwrap());
978978
// A hack to parse sha256d strings are sha256 so that we don't reverse them...
979979
let raw_expected = crate::hashes::sha256::Hash::from_str(expected_result).unwrap();
980-
let expected_result = SigHash::from_slice(&raw_expected[..]).unwrap();
980+
let expected_result = Sighash::from_slice(&raw_expected[..]).unwrap();
981981

982982
let mut cache = SighashCache::new(&tx);
983983
let value : confidential::Value = deserialize(&Vec::<u8>::from_hex(value).unwrap()[..]).unwrap();
@@ -1011,7 +1011,7 @@ mod tests{
10111011
let script = Script::from(Vec::<u8>::from_hex(script).unwrap());
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();
1014-
let expected_result = SigHash::from_slice(&raw_expected[..]).unwrap();
1014+
let expected_result = Sighash::from_slice(&raw_expected[..]).unwrap();
10151015
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);

src/taproot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const MIDSTATE_TAPTWEAK: [u8; 32] = [
4444
];
4545
// (rev) 09fb0cfc0dd530c6cb0821906b00201b9d6daec928ad42fbf5072e8a793fb707
4646

47-
/// The SHA-256 midstate value for the TapSigHash hash.
47+
/// The SHA-256 midstate value for the TapSighash hash.
4848
const MIDSTATE_TAPSIGHASH: [u8; 32] = [
4949
166, 230, 6, 120, 41, 228, 53, 167, 211, 20, 34, 171, 34, 191, 116, 23, 134,
5050
105, 138, 238, 229, 146, 92, 206, 255, 57, 14, 164, 52, 159, 126, 13

0 commit comments

Comments
 (0)