Move BlockHash From impls

Move the `From` impls on `BlockHash` to below the `BlockHash` impl
block.

Code move only, no other changes.
This commit is contained in:
Tobin C. Harding 2023-05-24 13:46:06 +10:00
parent b5aa482532
commit 3a9b5526b3
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 16 additions and 16 deletions

View File

@ -337,6 +337,22 @@ impl Block {
}
}
impl From<Header> 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<Block> 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<Header> 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<Block> 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;