From db9ec3bed8d6164a0345ba8db1e2162626db7cc5 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 20 Mar 2025 14:34:59 +1100 Subject: [PATCH] Remove From for $hash We provide the from/to_byte_array functions for casting between arrays. We shouldn't be supporting calls to `into` to quickly do the cast. We already removed the other direction, now remove this one. --- hashes/src/macros.rs | 6 ------ primitives/src/transaction.rs | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/hashes/src/macros.rs b/hashes/src/macros.rs index f1b06727c..2c9aa1bcf 100644 --- a/hashes/src/macros.rs +++ b/hashes/src/macros.rs @@ -158,12 +158,6 @@ macro_rules! hash_newtype { } } - impl $crate::_export::_core::convert::From<$newtype> for $hash { - fn from(hashtype: $newtype) -> $hash { - hashtype.0 - } - } - impl $crate::Hash for $newtype { type Bytes = <$hash as $crate::Hash>::Bytes; diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs index 764ed68c6..1c79a187d 100644 --- a/primitives/src/transaction.rs +++ b/primitives/src/transaction.rs @@ -151,7 +151,7 @@ impl Transaction { .collect(), output: self.output.clone(), }; - cloned_tx.compute_txid().into() + sha256d::Hash::from_byte_array(cloned_tx.compute_txid().to_byte_array()) } /// Computes the [`Txid`].