diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index b496787a..1db06b51 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -337,6 +337,22 @@ impl Block { } } +impl From
for BlockHash { + fn from(header: Header) -> BlockHash { header.block_hash() } +} + +impl From<&Header> for BlockHash { + fn from(header: &Header) -> BlockHash { header.block_hash() } +} + +impl From for BlockHash { + fn from(block: Block) -> BlockHash { block.block_hash() } +} + +impl From<&Block> for BlockHash { + fn from(block: &Block) -> BlockHash { block.block_hash() } +} + /// An error when looking up a BIP34 block height. #[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] @@ -375,22 +391,6 @@ impl std::error::Error for Bip34Error { } } -impl From
for BlockHash { - fn from(header: Header) -> BlockHash { header.block_hash() } -} - -impl From<&Header> for BlockHash { - fn from(header: &Header) -> BlockHash { header.block_hash() } -} - -impl From for BlockHash { - fn from(block: Block) -> BlockHash { block.block_hash() } -} - -impl From<&Block> for BlockHash { - fn from(block: &Block) -> BlockHash { block.block_hash() } -} - #[cfg(test)] mod tests { use hashes::hex::FromHex;