uw-miner-config #4
@ -1,102 +1,16 @@
|
||||
{application,gmhive_client,
|
||||
[{description,"Gajumaru Hive client"},
|
||||
{vsn,"0.2.1"},
|
||||
[{description,"Gajumaru Hive Client"},
|
||||
{vsn,"0.4.1"},
|
||||
{registered,[]},
|
||||
{applications,[kernel,stdlib,sasl,gproc,enoise,gmconfig,
|
||||
gmhive_protocol,gmhive_worker]},
|
||||
{mod,{gmhive_client,[]}},
|
||||
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
|
||||
gmconfig,gmhive_protocol,gmhive_worker]},
|
||||
{mod,{gmhc_app,[]}},
|
||||
{start_phases,[{connect_to_primary,[]}]},
|
||||
{env,[]},
|
||||
{modules,[base58,eblake2,eblake2_tests,timing,enacl_eqc,
|
||||
enacl_ext_eqc,enacl,enacl_ext,enacl_nif,enacl_SUITE,
|
||||
enoise,enoise_cipher_state,enoise_connection,
|
||||
enoise_crypto,enoise_hs_state,enoise_keypair,
|
||||
enoise_protocol,enoise_sym_state,
|
||||
enoise_bad_data_tests,enoise_chiper_state_tests,
|
||||
enoise_crypto_tests,enoise_hs_state_tests,
|
||||
enoise_protocol_tests,enoise_sym_state_tests,
|
||||
enoise_tests,enoise_utils,test_utils,gmconfig,
|
||||
gmconfig_schema_helpers,gmconfig_schema_utils,
|
||||
gmcuckoo,gmhc_app,gmhc_config,gmhc_config_schema,
|
||||
{modules,[gmhc_app,gmhc_config,gmhc_config_schema,
|
||||
gmhc_connector,gmhc_connectors_sup,gmhc_counters,
|
||||
gmhc_eureka,gmhc_events,gmhc_handler,gmhc_server,
|
||||
gmhc_sup,gmhc_workers,gmhive_client,gmhp_msgs,
|
||||
gmhw_blake2b_256,gmhw_pow,gmhw_pow_cuckoo,
|
||||
gmhw_siphash24,gmcuckoo_SUITE,gmhw_pow_cuckoo_tests,
|
||||
gmhw_pow_tests,gmser_api_encoder,gmser_chain_objects,
|
||||
gmser_contract_code,gmser_delegation,gmser_dyn,
|
||||
gmser_id,gmser_rlp,gmserialization,
|
||||
gmser_api_encoder_tests,gmser_chain_objects_tests,
|
||||
gmser_contract_code_tests,gmser_delegation_tests,
|
||||
gmser_rlp_tests,gproc,gproc_app,gproc_bcast,
|
||||
gproc_dist,gproc_info,gproc_init,gproc_lib,
|
||||
gproc_monitor,gproc_pool,gproc_ps,gproc_pt,gproc_sup,
|
||||
setup,setup_app,setup_file,setup_file_io_server,
|
||||
setup_gen,setup_lib,setup_srv,setup_sup,setup_zomp,
|
||||
testapp_app,testapp_sup,testapp_app,testapp_sup,
|
||||
hex_api,hex_api_auth,hex_api_key,hex_api_organization,
|
||||
hex_api_organization_member,hex_api_package,
|
||||
hex_api_package_owner,hex_api_release,hex_api_user,
|
||||
hex_core,hex_erl_tar,hex_filename,hex_http,
|
||||
hex_http_httpc,hex_licenses,hex_pb_names,
|
||||
hex_pb_package,hex_pb_signed,hex_pb_versions,
|
||||
hex_registry,hex_repo,hex_tarball,safe_erl_term,pc,
|
||||
pc_compilation,pc_port_env,pc_port_specs,pc_prv_clean,
|
||||
pc_prv_compile,pc_util,rebar3_hex,rebar3_hex_app,
|
||||
rebar3_hex_build,rebar3_hex_client,rebar3_hex_config,
|
||||
rebar3_hex_cut,rebar3_hex_error,rebar3_hex_file,
|
||||
rebar3_hex_httpc_adapter,rebar3_hex_io,rebar3_hex_key,
|
||||
rebar3_hex_organization,rebar3_hex_owner,
|
||||
rebar3_hex_publish,rebar3_hex_results,
|
||||
rebar3_hex_retire,rebar3_hex_search,rebar3_hex_user,
|
||||
rebar3_hex_version,
|
||||
rebar_aecuckooprebuilt_app_with_priv_from_git_resource,
|
||||
rebar_aecuckooprebuilt_dep,verl,verl_parser,base58,
|
||||
eblake2,eblake2_tests,timing,enacl_eqc,enacl_ext_eqc,
|
||||
enacl,enacl_ext,enacl_nif,enacl_SUITE,enoise,
|
||||
enoise_cipher_state,enoise_connection,enoise_crypto,
|
||||
enoise_hs_state,enoise_keypair,enoise_protocol,
|
||||
enoise_sym_state,enoise_bad_data_tests,
|
||||
enoise_chiper_state_tests,enoise_crypto_tests,
|
||||
enoise_hs_state_tests,enoise_protocol_tests,
|
||||
enoise_sym_state_tests,enoise_tests,enoise_utils,
|
||||
test_utils,gmconfig,gmconfig_schema_helpers,
|
||||
gmconfig_schema_utils,gmcuckoo,gmhp_msgs,
|
||||
gmhw_blake2b_256,gmhw_pow,gmhw_pow_cuckoo,
|
||||
gmhw_siphash24,gmcuckoo_SUITE,gmhw_pow_cuckoo_tests,
|
||||
gmhw_pow_tests,gmser_api_encoder,gmser_chain_objects,
|
||||
gmser_contract_code,gmser_delegation,gmser_dyn,
|
||||
gmser_id,gmser_rlp,gmserialization,
|
||||
gmser_api_encoder_tests,gmser_chain_objects_tests,
|
||||
gmser_contract_code_tests,gmser_delegation_tests,
|
||||
gmser_rlp_tests,gproc,gproc_app,gproc_bcast,
|
||||
gproc_dist,gproc_info,gproc_init,gproc_lib,
|
||||
gproc_monitor,gproc_pool,gproc_ps,gproc_pt,gproc_sup,
|
||||
setup,setup_app,setup_file,setup_file_io_server,
|
||||
setup_gen,setup_lib,setup_srv,setup_sup,setup_zomp,
|
||||
testapp_app,testapp_sup,testapp_app,testapp_sup,
|
||||
hex_api,hex_api_auth,hex_api_key,hex_api_organization,
|
||||
hex_api_organization_member,hex_api_package,
|
||||
hex_api_package_owner,hex_api_release,hex_api_user,
|
||||
hex_core,hex_erl_tar,hex_filename,hex_http,
|
||||
hex_http_httpc,hex_licenses,hex_pb_names,
|
||||
hex_pb_package,hex_pb_signed,hex_pb_versions,
|
||||
hex_registry,hex_repo,hex_tarball,safe_erl_term,pc,
|
||||
pc_compilation,pc_port_env,pc_port_specs,pc_prv_clean,
|
||||
pc_prv_compile,pc_util,rebar3_hex,rebar3_hex_app,
|
||||
rebar3_hex_build,rebar3_hex_client,rebar3_hex_config,
|
||||
rebar3_hex_cut,rebar3_hex_error,rebar3_hex_file,
|
||||
rebar3_hex_httpc_adapter,rebar3_hex_io,rebar3_hex_key,
|
||||
rebar3_hex_organization,rebar3_hex_owner,
|
||||
rebar3_hex_publish,rebar3_hex_results,
|
||||
rebar3_hex_retire,rebar3_hex_search,rebar3_hex_user,
|
||||
rebar3_hex_version,
|
||||
rebar_aecuckooprebuilt_app_with_priv_from_git_resource,
|
||||
rebar_aecuckooprebuilt_dep,verl,verl_parser,gmhc_app,
|
||||
gmhc_config,gmhc_config_schema,gmhc_connector,
|
||||
gmhc_connectors_sup,gmhc_counters,gmhc_eureka,
|
||||
gmhc_events,gmhc_handler,gmhc_server,gmhc_sup,
|
||||
gmhc_workers,gmhive_client]},
|
||||
gmhc_sup,gmhc_workers,gmhive_client]},
|
||||
{maintainers,["QPQ IaaS AG"]},
|
||||
{licensens,["ISC"]},
|
||||
{links,[{"gitea","https://git.qpq.swiss/gmhive_client"}]}]}.
|
||||
|
@ -3,9 +3,9 @@
|
||||
, pool => #{id => <<"ct_26xqeE3YKmZV8jrks57JSgZRCHSuG4RGzpnvdz6AAiSSTVbJRM">>,
|
||||
host => <<"127.0.0.1">>}
|
||||
, workers =>
|
||||
[#{executable => <<"mean15-generic">>, <<"executable_group">> => <<"gmcuckoo">>}
|
||||
,#{executable => <<"mean15-generic">>, <<"executable_group">> => <<"gmcuckoo">>}
|
||||
,#{executable => <<"mean15-generic">>, <<"executable_group">> => <<"gmcuckoo">>}
|
||||
,#{executable => <<"mean15-generic">>, <<"executable_group">> => <<"gmcuckoo">>}
|
||||
[#{executable => <<"mean15-generic">>}
|
||||
,#{executable => <<"mean15-generic">>}
|
||||
,#{executable => <<"mean15-generic">>}
|
||||
,#{executable => <<"mean15-generic">>}
|
||||
]
|
||||
}.
|
||||
|
@ -10,11 +10,11 @@
|
||||
{gmhive_protocol,
|
||||
{git, "https://git.qpq.swiss/QPQ-AG/gmhive_protocol.git",
|
||||
{ref, "818ce33"}}},
|
||||
{gmhive_worker, {git, "https://git.qpq.swiss/QPQ-AG/gmhive_worker", {ref, "708f1a6"}}},
|
||||
{gmhive_worker, {git, "https://git.qpq.swiss/QPQ-AG/gmhive_worker", {ref, "255ef59"}}},
|
||||
{gmconfig, {git, "https://git.qpq.swiss/QPQ-AG/gmconfig.git",
|
||||
{ref, "32c1ed5c4b"}}},
|
||||
{ref, "38620ff9e2"}}},
|
||||
{gproc, "1.0.0"},
|
||||
{setup, {git, "https://github.com/uwiger/setup", {ref, "3ad83ed"}}}
|
||||
{setup, {git, "https://github.com/uwiger/setup", {ref, "d9b0b51"}}}
|
||||
]}.
|
||||
|
||||
{relx, [
|
||||
|
15
rebar.lock
15
rebar.lock
@ -1,10 +1,5 @@
|
||||
{"1.2.0",
|
||||
[{<<"aecuckooprebuilt">>,
|
||||
{aecuckooprebuilt_app_with_priv_from_git,
|
||||
{git,"https://github.com/aeternity/cuckoo-prebuilt.git",
|
||||
{ref,"90afb699dc9cc41d033a7c8551179d32b3bd569d"}}},
|
||||
1},
|
||||
{<<"base58">>,
|
||||
[{<<"base58">>,
|
||||
{git,"https://git.qpq.swiss/QPQ-AG/erl-base58.git",
|
||||
{ref,"e6aa62eeae3d4388311401f06e4b939bf4e94b9c"}},
|
||||
2},
|
||||
@ -22,11 +17,11 @@
|
||||
0},
|
||||
{<<"gmconfig">>,
|
||||
{git,"https://git.qpq.swiss/QPQ-AG/gmconfig.git",
|
||||
{ref,"32c1ed5c4bc0913adc175fb18b1c9251acc7b606"}},
|
||||
{ref,"38620ff9e2289dff121377c382e4d5b08c719d87"}},
|
||||
0},
|
||||
{<<"gmcuckoo">>,
|
||||
{git,"https://git.qpq.swiss/QPQ-AG/gmcuckoo.git",
|
||||
{ref,"9f3aef96d8660e83ef8b5a7ee64908060a8c6572"}},
|
||||
{ref,"106e1cd2e4ff81286f6bc7d7c85f83bc20e14b82"}},
|
||||
1},
|
||||
{<<"gmhive_protocol">>,
|
||||
{git,"https://git.qpq.swiss/QPQ-AG/gmhive_protocol.git",
|
||||
@ -34,7 +29,7 @@
|
||||
0},
|
||||
{<<"gmhive_worker">>,
|
||||
{git,"https://git.qpq.swiss/QPQ-AG/gmhive_worker",
|
||||
{ref,"708f1a62f9584f874eb9436a974401b5d4272d9f"}},
|
||||
{ref,"255ef59ccd7f795d2d25f2d0ebcf24e3251b6f36"}},
|
||||
0},
|
||||
{<<"gmserialization">>,
|
||||
{git,"https://git.qpq.swiss/QPQ-AG/gmserialization.git",
|
||||
@ -43,7 +38,7 @@
|
||||
{<<"gproc">>,{pkg,<<"gproc">>,<<"1.0.0">>},0},
|
||||
{<<"setup">>,
|
||||
{git,"https://github.com/uwiger/setup",
|
||||
{ref,"3ad83ed3cade6780897d11f5f0d987012b93345b"}},
|
||||
{ref,"d9b0b51505ff75c459f1ab62bd907ca5e3a32291"}},
|
||||
0}]}.
|
||||
[
|
||||
{pkg_hash,[
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
-export([ load_config/0
|
||||
, get_config/1
|
||||
, verify_cfg_props/1
|
||||
]).
|
||||
|
||||
-include_lib("kernel/include/logger.hrl").
|
||||
@ -13,6 +12,7 @@ load_config() ->
|
||||
gmconfig:load_user_config(report),
|
||||
gmconfig:apply_os_env(),
|
||||
gmconfig:process_plain_args(),
|
||||
check_application_env(),
|
||||
ok.
|
||||
|
||||
instrument_gmconfig() ->
|
||||
@ -31,37 +31,35 @@ gmconfig_env() ->
|
||||
get_config(Path) ->
|
||||
gmconfig:get_config(Path, cpath(Path)).
|
||||
|
||||
cpath([<<"pubkey">>]) -> [user_config, env(pubkey ) ];
|
||||
cpath([<<"extra_pubkeys">>]) -> [user_config, env(extra_pubkeys ), schema_default];
|
||||
cpath([<<"pool_admin">>, <<"url">>]) -> [user_config, env(pool_admin_url), schema_default];
|
||||
cpath([<<"workers">>]) -> [user_config, env(workers ), schema_default];
|
||||
cpath(_) -> [user_config, schema_default].
|
||||
|
||||
env2cpath(pubkey ) -> [<<"pubkey">>];
|
||||
env2cpath(extra_pubkeys ) -> [<<"extra_pubkeys">>];
|
||||
env2cpath(pool_admin_url) -> [<<"pool_admin">>, <<"url">>];
|
||||
env2cpath(workers ) -> [<<"workers">>].
|
||||
|
||||
verify_cfg_props(PropList) ->
|
||||
Cfg = lists:foldl(
|
||||
fun({K,V}, M) ->
|
||||
CfgK = env2cpath(K),
|
||||
gmconfig:merge_config_maps(M, to_cfg_map(CfgK, V))
|
||||
end, #{}, PropList),
|
||||
case gmconfig_schema_utils:valid(Cfg) of
|
||||
Ok when is_map(Ok) ->
|
||||
check_application_env() ->
|
||||
case lists:foldl(fun appl_env/2, #{}, env_keys()) of
|
||||
C when map_size(C) == 0 ->
|
||||
ok;
|
||||
Other ->
|
||||
error({invalid_config, Other})
|
||||
C ->
|
||||
gmconfig:update_config(C)
|
||||
end.
|
||||
appl_env(K, C) ->
|
||||
case application:get_env(gmhive_client, K) of
|
||||
{ok, V} -> appl_env(K, V, C);
|
||||
undefined -> C
|
||||
end.
|
||||
|
||||
to_cfg_map(K, V) ->
|
||||
to_cfg_map(K, V, #{}).
|
||||
appl_env(bin_dir_hook , H , C) -> set_bin_dir_hook(H), C;
|
||||
appl_env(pubkey , K , C) -> C#{<<"pubkey">> => K};
|
||||
appl_env(extra_pubkeys , Ks, C) -> C#{<<"extra_pubkeys">> => Ks};
|
||||
appl_env(pool_admin_url, U , C) -> merge(C, #{<<"pool_admin">> => #{<<"url">> => U}});
|
||||
appl_env(workers , Ws, C) -> C#{<<"workers">> => Ws}.
|
||||
|
||||
to_cfg_map([H], V, M) ->
|
||||
M#{H => V};
|
||||
to_cfg_map([H|T], V, M) ->
|
||||
M#{H => to_cfg_map(T, V, M)}.
|
||||
set_bin_dir_hook({Mod, F}) when is_atom(Mod), is_atom(F) ->
|
||||
application:set_env(gmhive_worker, bin_dir_hook, {Mod, F}).
|
||||
|
||||
env(K) ->
|
||||
{env, gmhive_client, K}.
|
||||
env_keys() -> [pubkey, extra_pubkeys, pool_admin_url, workers, network, bin_dir_hook].
|
||||
|
||||
cpath([<<"pubkey">>]) -> [user_config ];
|
||||
cpath([<<"extra_pubkeys">>]) -> [user_config, schema_default];
|
||||
cpath([<<"pool_admin">>, <<"url">>]) -> [user_config, schema_default];
|
||||
cpath([<<"workers">>]) -> [user_config, schema_default];
|
||||
cpath(_) -> [user_config, schema_default].
|
||||
|
||||
merge(A, B) ->
|
||||
gmconfig:merge_config_maps(A, B).
|
||||
|
@ -24,7 +24,8 @@ to_json() ->
|
||||
schema() ->
|
||||
obj(schema_init(),
|
||||
#{
|
||||
pubkey => str(#{pattern => ?ACCOUNT_PATTERN},
|
||||
network => str(#{ default => <<"mainnet">> })
|
||||
, pubkey => str(#{pattern => ?ACCOUNT_PATTERN},
|
||||
<<"Primary client pubkey">>)
|
||||
, extra_pubkeys => array(#{ description =>
|
||||
<<"Additional worker pubkeys, sharing rewards">>
|
||||
@ -52,7 +53,14 @@ pool() ->
|
||||
pool_admin() ->
|
||||
obj(#{
|
||||
url => str(#{ default => <<"https://test.gajumining.com/api/workers/{CLIENT_ID}">>
|
||||
, description => <<"URL of Eureka worker api">> })
|
||||
, description => <<"URL of Eureka worker api">> }),
|
||||
default_per_network =>
|
||||
obj(#{
|
||||
testnet =>
|
||||
str(#{default => <<"https://test.gajumining.com/api/workers/{CLIENT_ID}">>})
|
||||
, mainnet =>
|
||||
str(#{default => <<"https://gajumining.com/api/workers/{CLIENT_ID}">>})
|
||||
})
|
||||
}).
|
||||
|
||||
workers() ->
|
||||
@ -65,17 +73,8 @@ workers() ->
|
||||
#{executable =>
|
||||
str(#{default => <<"mean29-generic">>,
|
||||
description =>
|
||||
<<"Executable binary of the worker. Options are: \"mean29-generic\""
|
||||
" (memory-intensive), "
|
||||
"\"mean29-avx2\" (memory-intensive, benefits from faster CPU supporting"
|
||||
" AVX2 instructions), "
|
||||
"\"lean29-generic\" (CPU-intensive, useful if memory-constrained), "
|
||||
"\"lean29-avx2\" (CPU-intensive, useful if memory-constrained, benefits "
|
||||
"from faster CPU supporting AVX2 instructions).">>}),
|
||||
executable_group =>
|
||||
str(#{description => <<"Group of executable binaries of the worker.">>,
|
||||
enum => [ <<"aecuckoo">>, <<"aecuckooprebuilt">>, <<"gmcuckoo">>, <<"cuda">>, <<"gajumine">> ],
|
||||
default => <<"aecuckoo">>}),
|
||||
<<"Executable binary of the worker. Can be a fully qualified path, \n"
|
||||
"but the software may apply default logic to locate a plain basename.">>}),
|
||||
extra_args =>
|
||||
str(#{description => <<"Extra arguments to pass to the worker executable binary. "
|
||||
"The safest choice is specifying no arguments i.e. empty string.">>,
|
||||
|
@ -6,15 +6,27 @@
|
||||
-include("gmhc_events.hrl").
|
||||
|
||||
get_pool_address() ->
|
||||
URL0 = gmhc_config:get_config([<<"pool_admin">>, <<"url">>]),
|
||||
case gmconfig:find_config([<<"pool_admin">>, <<"url">>], [user_config]) of
|
||||
{ok, URL0} ->
|
||||
case expand_url(URL0) of
|
||||
<<"local">> ->
|
||||
#{<<"address">> => <<"127.0.0.1">>,
|
||||
<<"port">> => gmconfig:get_config([<<"pool">>, <<"port">>], [schema_default]),
|
||||
<<"port">> => gmconfig:get_config(
|
||||
[<<"pool">>, <<"port">>], [schema_default]),
|
||||
<<"pool_id">> => gmhc_config:get_config([<<"pool">>, <<"id">>]) };
|
||||
URL ->
|
||||
?LOG_INFO("Trying to connect to ~p", [URL]),
|
||||
connect1(URL)
|
||||
end;
|
||||
undefined ->
|
||||
Network = gmconfig:get_config([<<"network">>]),
|
||||
URL0 = gmconfig:get_config([ <<"pool_admin">>
|
||||
, <<"default_per_network">>
|
||||
, Network ],
|
||||
[schema_default]),
|
||||
URL = expand_url(URL0),
|
||||
?LOG_INFO("Using default for ~p: ~p", [Network, URL]),
|
||||
connect1(URL)
|
||||
end.
|
||||
|
||||
connect1(URL0) ->
|
||||
|
@ -102,13 +102,21 @@ handle_cast({from_pool, #{via := Connector,
|
||||
#{candidate := Cand0}}},
|
||||
#st{workers = Workers} = S) ->
|
||||
Cand = maps:put(via, Connector, decode_candidate_hash(Cand0)),
|
||||
%% ?LOG_DEBUG("Got new candidate; will mine it: ~p", [Cand]),
|
||||
?LOG_DEBUG("Got new candidate; will mine it: ~p", [Cand]),
|
||||
%%
|
||||
%% We could check whether we have already received the candidate ...
|
||||
%% For now, stop all workers, restart with new candidate
|
||||
try
|
||||
Workers1 = stop_workers(Workers),
|
||||
{Workers2, Cand1} = assign_nonces(Workers1, Cand),
|
||||
#st{candidate = Cand2} = S1 = maybe_request_nonces(S#st{candidate = Cand1}),
|
||||
NewWorkers = [spawn_worker(W, Cand2) || W <- Workers2],
|
||||
{noreply, S1#st{workers = NewWorkers}};
|
||||
{noreply, S1#st{workers = NewWorkers}}
|
||||
catch
|
||||
Cat:Err:St ->
|
||||
?LOG_ERROR("CAUGHT ~p:~p / ~p", [Cat, Err, St]),
|
||||
{noreply, S}
|
||||
end;
|
||||
handle_cast({disconnected, Id}, #st{connected = Conn} = S) ->
|
||||
?LOG_DEBUG("disconnected: ~p", [Id]),
|
||||
Conn1 = maps:remove(Id, Conn),
|
||||
@ -122,9 +130,7 @@ handle_cast(_Msg, S) ->
|
||||
{noreply, S}.
|
||||
|
||||
handle_info({'DOWN', MRef, process, Pid, Reason}, #st{ workers = Workers
|
||||
, connected = Connected
|
||||
, working = Working} = S)
|
||||
when ?CONNECTED(S), Working ->
|
||||
, connected = Connected} = S) ->
|
||||
%% ?LOG_DEBUG("DOWN from ~p: ~p", [Pid, Reason]),
|
||||
case lists:keyfind(Pid, #worker.pid, Workers) of
|
||||
#worker{mref = MRef} = W ->
|
||||
@ -240,9 +246,10 @@ handle_worker_result(Error, W, S) ->
|
||||
report_solutions_(Solutions, W, S) ->
|
||||
case report_solutions(Solutions, W, S) of
|
||||
ok ->
|
||||
Ws = reset_worker(W, S#st.workers),
|
||||
Ws1 = stop_workers(Ws),
|
||||
{stopped, S#st{workers = Ws1}};
|
||||
%% Ws = reset_worker(W, S#st.workers),
|
||||
%% Ws1 = stop_workers(Ws),
|
||||
%% {stopped, S#st{workers = Ws1}};
|
||||
{continue, S};
|
||||
continue ->
|
||||
{continue, S};
|
||||
{error, _} ->
|
||||
@ -302,7 +309,9 @@ stop_workers_for_seq(Seq, Workers) ->
|
||||
[stop_worker(W) || #worker{cand = #{seq := Seq1}} = W <- Workers,
|
||||
Seq1 =:= Seq].
|
||||
|
||||
stop_worker(#worker{pid = Pid, mref = MRef} = W) when is_pid(Pid) ->
|
||||
stop_worker(#worker{pid = Pid} = W) when is_pid(Pid) ->
|
||||
MRef = erlang:monitor(process, Pid),
|
||||
?LOG_DEBUG("Will stop worker ~p (MRef = ~p)", [Pid, MRef]),
|
||||
exit(Pid, kill),
|
||||
receive
|
||||
{'EXIT', Pid, _} -> ok;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
-include_lib("kernel/include/logger.hrl").
|
||||
|
||||
-define(DEFAULT_EXECUTABLE_GROUP , <<"gajumine">>).
|
||||
-define(DEFAULT_EXECUTABLE_GROUP , <<"gmhive">>).
|
||||
-define(DEFAULT_EXTRA_ARGS , <<>>).
|
||||
-define(DEFAULT_HEX_ENCODED_HEADER , false).
|
||||
-define(DEFAULT_REPEATS , 1).
|
||||
@ -55,7 +55,7 @@ generate_from_hash(Hash, Target, Nonce, Config, WorkerInstance) ->
|
||||
|
||||
build_worker_config(Config) when is_map(Config) ->
|
||||
Exec = maps:get(<<"executable">>, Config),
|
||||
ExecGroup = maps:get(<<"executable_group">>, Config, ?DEFAULT_EXECUTABLE_GROUP),
|
||||
ExecGroup = ?DEFAULT_EXECUTABLE_GROUP,
|
||||
ExtraArgs = maps:get(<<"extra_args">>, Config, ?DEFAULT_EXTRA_ARGS),
|
||||
HexEncHdr = maps:get(<<"hex_encoded_header">>, Config,
|
||||
hex_encoding_default(ExecGroup, Exec)),
|
||||
|
@ -4,8 +4,12 @@
|
||||
{prefix,"gmhc"}.
|
||||
{desc,"Gajumaru Hive Client"}.
|
||||
{author,"Ulf Wiger, QPQ AG"}.
|
||||
{package_id,{"uwiger","gmhive_client",{0,2,1}}}.
|
||||
{deps,[{"uwiger","gmhive_worker",{0,1,1}},
|
||||
{package_id,{"uwiger","gmhive_client",{0,4,1}}}.
|
||||
{deps,[{"uwiger","gmcuckoo",{1,2,2}},
|
||||
{"uwiger","gmhive_worker",{0,3,0}},
|
||||
{"otpr","eblake2",{1,0,1}},
|
||||
{"otpr","base58",{0,1,1}},
|
||||
{"otpr","gmserialization",{0,1,3}},
|
||||
{"uwiger","gmhive_protocol",{0,1,1}},
|
||||
{"uwiger","setup",{2,2,4}},
|
||||
{"uwiger","gproc",{1,0,1}},
|
||||
|
Loading…
x
Reference in New Issue
Block a user