Do not use private constructor for txid hash types

In preparation for moving the txid hash types to `primitives` stop using
private constructors and cast the hash types as is typical.
This commit is contained in:
Tobin C. Harding 2024-09-03 11:25:15 +10:00
parent 98328b5a7b
commit 68c9e28165
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -582,7 +582,7 @@ impl Transaction {
self.input.consensus_encode(&mut enc).expect("engines don't error");
self.output.consensus_encode(&mut enc).expect("engines don't error");
self.lock_time.consensus_encode(&mut enc).expect("engines don't error");
Txid(sha256d::Hash::from_engine(enc))
Txid::from_byte_array(sha256d::Hash::from_engine(enc).to_byte_array())
}
/// Computes the segwit version of the transaction id.
@ -603,7 +603,7 @@ impl Transaction {
pub fn compute_wtxid(&self) -> Wtxid {
let mut enc = sha256d::Hash::engine();
self.consensus_encode(&mut enc).expect("engines don't error");
Wtxid(sha256d::Hash::from_engine(enc))
Wtxid::from_byte_array(sha256d::Hash::from_engine(enc).to_byte_array())
}
/// Returns the weight of this transaction, as defined by BIP-141.