Skip to content

Commit 4e24b30

Browse files
committed
Use sighash not sig_hash in identifiers
Recently we update all types and docs to use `Sighash` instead of `SigHash` because 'sighash' is a single word. We should apply the same logic to functions and variable names. Do not use an underscore in the identifier 'sighash'.
1 parent 9c42391 commit 4e24b30

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/util/psbt/serialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ mod tests {
373373
use super::*;
374374

375375
#[test]
376-
fn can_deserialize_non_standard_psbt_sig_hash_type() {
376+
fn can_deserialize_non_standard_psbt_sighash_type() {
377377
let non_standard_sighash = [222u8, 0u8, 0u8, 0u8]; // 32 byte value.
378378
let sighash = PsbtSighashType::deserialize(&non_standard_sighash);
379379
assert!(sighash.is_ok())

src/util/sighash.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,9 +1039,9 @@ mod tests {
10391039
Prevouts::All(&prevouts)
10401040
};
10411041

1042-
let mut sig_hash_cache = SighashCache::new(&tx);
1042+
let mut sighash_cache = SighashCache::new(&tx);
10431043

1044-
let hash = sig_hash_cache
1044+
let hash = sighash_cache
10451045
.taproot_signature_hash(input_index, &prevouts, annex, leaf_hash, sighash_type)
10461046
.unwrap();
10471047
let expected = Vec::from_hex(expected_hash).unwrap();
@@ -1093,7 +1093,7 @@ mod tests {
10931093
let expected_tweak = hex_hash!(TapTweakHash, inp["intermediary"]["tweak"].as_str().unwrap());
10941094
let expected_tweaked_priv_key = hex_hash!(SecretKey, inp["intermediary"]["tweakedPrivkey"].as_str().unwrap());
10951095
let expected_sig_msg = Vec::<u8>::from_hex(inp["intermediary"]["sigMsg"].as_str().unwrap()).unwrap();
1096-
let expected_sig_hash = hex_hash!(TapSighashHash, inp["intermediary"]["sigHash"].as_str().unwrap());
1096+
let expected_sighash = hex_hash!(TapSighashHash, inp["intermediary"]["sigHash"].as_str().unwrap());
10971097
let sig_str = inp["expected"]["witness"][0].as_str().unwrap();
10981098
let (expected_key_spend_sig, expected_hash_ty) = if sig_str.len() == 128 {
10991099
(secp256k1::schnorr::Signature::from_str(sig_str).unwrap(), SchnorrSighashType::Default)
@@ -1117,21 +1117,21 @@ mod tests {
11171117
None,
11181118
hash_ty
11191119
).unwrap();
1120-
let sig_hash = cache.taproot_signature_hash(
1120+
let sighash = cache.taproot_signature_hash(
11211121
tx_ind,
11221122
&Prevouts::All(&utxos),
11231123
None,
11241124
None,
11251125
hash_ty
11261126
).unwrap();
11271127

1128-
let msg = secp256k1::Message::from_slice(&sig_hash).unwrap();
1128+
let msg = secp256k1::Message::from_slice(&sighash).unwrap();
11291129
let key_spend_sig = secp.sign_schnorr_with_aux_rand(&msg, &tweaked_keypair, &[0u8; 32]);
11301130

11311131
assert_eq!(expected_internal_pk, internal_key);
11321132
assert_eq!(expected_tweak, tweak);
11331133
assert_eq!(expected_sig_msg, sig_msg);
1134-
assert_eq!(expected_sig_hash, sig_hash);
1134+
assert_eq!(expected_sighash, sighash);
11351135
assert_eq!(expected_hash_ty, hash_ty);
11361136
assert_eq!(expected_key_spend_sig, key_spend_sig);
11371137

0 commit comments

Comments
 (0)