From 8ac329df0294f16efbc48a2785eda165878d3511 Mon Sep 17 00:00:00 2001 From: Thomas Winget Date: Wed, 7 Oct 2015 22:28:43 -0400 Subject: doxygen documentation for difficulty functions --- src/cryptonote_core/difficulty.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/cryptonote_core/difficulty.h') diff --git a/src/cryptonote_core/difficulty.h b/src/cryptonote_core/difficulty.h index d49c2f3b8..910f97035 100644 --- a/src/cryptonote_core/difficulty.h +++ b/src/cryptonote_core/difficulty.h @@ -39,6 +39,18 @@ namespace cryptonote { typedef std::uint64_t difficulty_type; + /** + * @brief checks if a hash fits the given difficulty + * + * The hash passes if (hash * difficulty) < 2^192. + * Phrased differently, if (hash * difficulty) fits without overflow into + * the least significant 192 bits of the 256 bit multiplication result. + * + * @param hash the hash to check + * @param difficulty the difficulty to check against + * + * @return true if valid, else false + */ bool check_hash(const crypto::hash &hash, difficulty_type difficulty); difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties, size_t target_seconds); } -- cgit v1.2.3