Trait WorkExt

Source
pub trait WorkExt {
    // Required methods
    fn multiply_work_by_u32(
        self,
        factor: u32,
    ) -> Result<Work, ChainWorkOverflow>;
    fn to_string_hex(&self) -> String;
}

Required Methods§

Source

fn multiply_work_by_u32(self, factor: u32) -> Result<Work, ChainWorkOverflow>

Multiplies the Work by a u32 factor, returning an error if overflow occurs.

Source

fn to_string_hex(&self) -> String

Returns the hexadecimal string representation of the Work.

In rust-bitcoin, calling to_string on Work returns the value in decimal because it wraps a U256, which defaults to decimal string conversion. However, Bitcoin Core represents targets in hexadecimal. This method ensures the `Work`` is returned in hexadecimal format, consistent with Bitcoin Core.

Implementations on Foreign Types§

Source§

impl WorkExt for Work

Implementors§