Skip to content

Commit

Permalink
Document current behaviour of difficulty_float
Browse files Browse the repository at this point in the history
Improve rustdocs on the `Target::difficulty_float` function,
specifically the return value if self is zero.
  • Loading branch information
tcharding committed Apr 2, 2024
1 parent 3d01146 commit c1ba496
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bitcoin/src/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ impl Target {
///
/// See [`difficulty`] for details.
///
/// # Returns
///
/// Returns [`f64::INFINITY`] if `self` is zero (caused by divide by zero).
///
/// [`difficulty`]: Target::difficulty
#[cfg_attr(all(test, mutate), mutate)]
pub fn difficulty_float(&self) -> f64 { TARGET_MAX_F64 / self.0.to_f64() }
Expand Down

0 comments on commit c1ba496

Please sign in to comment.