From 00de709dd87d83cdaa7b92da9f08f2f4cf9c6d1e Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 13 Oct 2020 07:06:45 +1000 Subject: [PATCH] impl From for ExpandedDifficulty --- zebra-chain/src/work/difficulty.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zebra-chain/src/work/difficulty.rs b/zebra-chain/src/work/difficulty.rs index 12f0bc13..98b43f28 100644 --- a/zebra-chain/src/work/difficulty.rs +++ b/zebra-chain/src/work/difficulty.rs @@ -213,7 +213,7 @@ impl CompactDifficulty { // zcashd rejects zero values, without comparing the hash None } else { - Some(ExpandedDifficulty(result)) + Some(result.into()) } } @@ -256,7 +256,12 @@ impl ExpandedDifficulty { /// Hashes are not used to calculate the difficulties of future blocks, so /// users of this module should avoid converting hashes into difficulties. fn from_hash(hash: &block::Hash) -> ExpandedDifficulty { - ExpandedDifficulty(U256::from_little_endian(&hash.0)) + U256::from_little_endian(&hash.0).into() +} + +impl From for ExpandedDifficulty { + fn from(value: U256) -> Self { + ExpandedDifficulty(value) } }