Use defines from .hrl in the code

This commit is contained in:
Juraj Hlista
2019-03-12 10:28:36 +07:00
parent 82a7cb813a
commit 73b70519f1
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
-include("aeminer.hrl").
-type nonce() :: 0..?MAX_NONCE.
-type nonce() :: ?MIN_NONCE..?MAX_NONCE.
-type int_target() :: integer().
+3 -3
View File
@@ -464,7 +464,7 @@ parse_generation_result(["Solution" ++ NonceValuesStr | Rest],
[NonceStr | SolStrs] = string:tokens(NonceValuesStr, " "),
Soln = [list_to_integer(string:trim(V, both, [$\r]), 16) || V <- SolStrs],
case {length(Soln), test_target(Soln, Target, EdgeBits)} of
{42, true} ->
{?SOLUTION_SIZE, true} ->
stop_execution(OsPid),
case parse_nonce_str(NonceStr) of
{ok, Nonce} ->
@@ -474,8 +474,8 @@ parse_generation_result(["Solution" ++ NonceValuesStr | Rest],
?debug("Bad nonce: ~p", [Err]),
Err
end;
{N, _} when N /= 42 ->
?debug("Solution has wrong length (~p) should be 42", [N]),
{N, _} when N /= ?SOLUTION_SIZE ->
?debug("Solution has wrong length (~p) should be ~p", [N, ?SOLUTION_SIZE]),
%% No nonce in solution, old miner exec?
stop_execution(OsPid),
{error, bad_miner};