From 68124a3355ada5613e357a5afe45f890458884d5 Mon Sep 17 00:00:00 2001 From: Juraj Hlista Date: Tue, 26 Feb 2019 18:01:26 +0700 Subject: [PATCH] Fix picking of random nonce --- src/aeminer_pow.erl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/aeminer_pow.erl b/src/aeminer_pow.erl index f114899..b9d0d20 100644 --- a/src/aeminer_pow.erl +++ b/src/aeminer_pow.erl @@ -40,9 +40,6 @@ -type config() :: aeminer_pow_cuckoo:config(). -%% 10^24, approx. 2^80 --define(NONCE_RANGE, 1000000000000000000000000). - %%------------------------------------------------------------------------------ %% Target threshold and difficulty %% @@ -121,7 +118,7 @@ next_nonce(Nonce, Cfg) -> -spec pick_nonce() -> nonce(). pick_nonce() -> - rand:uniform(?NONCE_RANGE) band ?MAX_NONCE. + rand:uniform(?MAX_NONCE + 1) - 1. -spec trim_nonce(nonce(), config()) -> nonce(). trim_nonce(Nonce, Cfg) ->