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.
This commit is contained in:
parent
1c04a99ec3
commit
c2bbf7c343
|
@ -183,6 +183,7 @@ mod tests {
|
||||||
use crate::blockdata::transaction::Transaction;
|
use crate::blockdata::transaction::Transaction;
|
||||||
use crate::consensus::encode::deserialize;
|
use crate::consensus::encode::deserialize;
|
||||||
use crate::hashes::hex::FromHex;
|
use crate::hashes::hex::FromHex;
|
||||||
|
use crate::util::sighash::SighashCache;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -191,9 +192,9 @@ mod tests {
|
||||||
let script = Script::from(Vec::<u8>::from_hex(script).unwrap());
|
let script = Script::from(Vec::<u8>::from_hex(script).unwrap());
|
||||||
let raw_expected = Sighash::from_hex(expected_result).unwrap();
|
let raw_expected = Sighash::from_hex(expected_result).unwrap();
|
||||||
let expected_result = Sighash::from_slice(&raw_expected[..]).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 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);
|
assert_eq!(actual_result, expected_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue