Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Confirm there are GRPC subscribers before including PoC keys in heart…
Browse files Browse the repository at this point in the history
…beat
  • Loading branch information
PaulVMo committed Oct 24, 2022
1 parent cc3bb64 commit d05e0d8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/miner_val_heartbeat.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

-ifdef(TEST).
-define(BYPASS_IP_CHECK,true).
-define(BYPASS_GRPC_CHECK,true).
-else.
-define(BYPASS_IP_CHECK,false).
-define(BYPASS_GRPC_CHECK,false).
-endif.


Expand Down Expand Up @@ -105,7 +107,15 @@ handle_info({blockchain_event, {add_block, Hash, Sync, _Ledger}},
%% key proposals for this heartbeat
%% hashes of the public keys are included in the HB
%% public and private keys are cached locally
{EmpKeys, EmpKeyHashes} = generate_poc_keys(Ledger),
%% but only do this is there are gRPC clients which indicates
%% that this validator is configured to receive poc receipts
{EmpKeys, EmpKeyHashes} = case ?BYPASS_GRPC_CHECK orelse length(pg:get_members(<<"activity_check_notification">>)) > 0 of
true ->
generate_poc_keys(Ledger);
_ ->
lager:info("No GRPC , excluding PoC ephemeral keys from heartbeat; open grpc port"),
{[],[]}
end,
lager:debug("HB poc ephemeral keys ~p", [EmpKeys]),
ok = miner_poc_mgr:save_local_poc_keys(Height, EmpKeys),
%% include any inactive GWs which have since come active
Expand Down

0 comments on commit d05e0d8

Please sign in to comment.