From 68c9e2816500a84d6d8b70c7c7c9024a9011cb98 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 3 Sep 2024 11:25:15 +1000 Subject: [PATCH] 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. --- bitcoin/src/blockdata/transaction.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 62b70e54b..4cfd65738 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -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.