diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index 2990ee86..b09dd6a7 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -425,6 +425,30 @@ impl std::error::Error for Bip34Error { } } +impl From for BlockHash { + fn from(header: BlockHeader) -> BlockHash { + header.block_hash() + } +} + +impl From<&BlockHeader> for BlockHash { + fn from(header: &BlockHeader) -> 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 crate::hashes::hex::FromHex; diff --git a/bitcoin/src/blockdata/script.rs b/bitcoin/src/blockdata/script.rs index 43cb6e83..fc536f23 100644 --- a/bitcoin/src/blockdata/script.rs +++ b/bitcoin/src/blockdata/script.rs @@ -760,6 +760,30 @@ impl From> for Script { fn from(v: Vec) -> Script { Script(v.into_boxed_slice()) } } +impl From