Merge pull request #4 from aeternity/fix-random-nonce
Fix picking of random nonce
This commit is contained in:
commit
c6d2c9f0dd
@ -40,9 +40,6 @@
|
|||||||
|
|
||||||
-type config() :: aeminer_pow_cuckoo:config().
|
-type config() :: aeminer_pow_cuckoo:config().
|
||||||
|
|
||||||
%% 10^24, approx. 2^80
|
|
||||||
-define(NONCE_RANGE, 1000000000000000000000000).
|
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Target threshold and difficulty
|
%% Target threshold and difficulty
|
||||||
%%
|
%%
|
||||||
@ -121,7 +118,7 @@ next_nonce(Nonce, Cfg) ->
|
|||||||
|
|
||||||
-spec pick_nonce() -> nonce().
|
-spec pick_nonce() -> nonce().
|
||||||
pick_nonce() ->
|
pick_nonce() ->
|
||||||
rand:uniform(?NONCE_RANGE) band ?MAX_NONCE.
|
rand:uniform(?MAX_NONCE + 1) - 1.
|
||||||
|
|
||||||
-spec trim_nonce(nonce(), config()) -> nonce().
|
-spec trim_nonce(nonce(), config()) -> nonce().
|
||||||
trim_nonce(Nonce, Cfg) ->
|
trim_nonce(Nonce, Cfg) ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user