pub fn bits_to_difficulty(n_compact: u32) -> U256 {
    let n_size: u32 = n_compact >> 24;
    let mut n_word: u32 = n_compact & 0x007fffff;
    let mut diff: U256;
    if n_size <= 3 {
        n_word >>= 8 * (3 - n_size);
        diff = U256::from(n_word);
    } else {
        diff = U256::from(n_word);
        diff <<= 8 * (n_size - 3);
    }
    diff
}
// Convert bits encoding into a difficulty number.
// See https://en.bitcoin.it/wiki/Difficulty.
// From https://bitcoin.stackexchange.com/questions/30467/what-are-the-equations-to-convert-between-bits-and-difficulty.
Convert bits encoding into a difficulty number.
Convert bits encoding into a difficulty number .
pub fn bits_to_difficulty(n_compact: u32) -> U256 {
    let n_size: u32 = n_compact >> 24;
    let mut n_word: u32 = n_compact & 0x007fffff;
    let mut diff: U256;
    if n_size <= 3 {
        n_word >>= 8 * (3 - n_size);
        diff = U256::from(n_word);
    } else {
        diff = U256::from(n_word);
        diff <<= 8 * (n_size - 3);
    }
    diff
}
pub fn bits_to_difficulty ( n_compact : u32 ) -> U256 { let n_size : u32 = n_compact >> 24 ; let mut n_word : u32 = n_compact & 0x007fffff ; let mut diff : U256 ; if n_size <= 3 { n_word >>= 8 * ( 3 - n_size ) ; diff = U256 :: from ( n_word ) ; } else { diff = U256 :: from ( n_word ) ; diff <<= 8 * ( n_size - 3 ) ; } diff }
Convert bits encoding into a difficulty number.
Convert bits encoding into a difficulty number .
n_compact
u32
n_compact
u32