From c2bbf7c34327990187351b89923d092a0fb9a1e4 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 3 Aug 2022 12:30:20 +1000 Subject: [PATCH] Use SighashCache instead of SigHashCache The `bip143::SigHashCache` is deprecated in favour of `sighash::SighashCache` however we still use it in `bip143` unit tests. Use the new `sighash::SighashCache` in `bip143` unit tests. --- src/util/bip143.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/bip143.rs b/src/util/bip143.rs index 0bed0daf..11414e4e 100644 --- a/src/util/bip143.rs +++ b/src/util/bip143.rs @@ -183,6 +183,7 @@ mod tests { use crate::blockdata::transaction::Transaction; use crate::consensus::encode::deserialize; use crate::hashes::hex::FromHex; + use crate::util::sighash::SighashCache; use super::*; @@ -191,9 +192,9 @@ mod tests { let script = Script::from(Vec::::from_hex(script).unwrap()); let raw_expected = Sighash::from_hex(expected_result).unwrap(); let expected_result = Sighash::from_slice(&raw_expected[..]).unwrap(); - let mut cache = SigHashCache::new(&tx); + let mut cache = SighashCache::new(&tx); let sighash_type = EcdsaSighashType::from_u32_consensus(hash_type); - let actual_result = cache.signature_hash(input_index, &script, value, sighash_type); + let actual_result = cache.segwit_signature_hash(input_index, &script, value, sighash_type).unwrap(); assert_eq!(actual_result, expected_result); }