Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
add override for select proposal count
Browse files Browse the repository at this point in the history
  • Loading branch information
andymck committed May 21, 2022
1 parent ce5f544 commit 0d330f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/blockchain_vars.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@
%% when determining if a GW is active or inactive: boolean
-define(harmonize_activity_on_hip17_interactivity_blocks, harmonize_activity_on_hip17_interactivity_blocks).

-define(poc_hardcode_poc_selection_count, poc_hardcode_poc_selection_count).

%% Number of blocks to wait before a hotspot can be eligible to participate in a poc
%% challenge. This would avoid new hotspots getting challenged before they sync to an
%% acceptable height.
Expand Down
10 changes: 8 additions & 2 deletions src/ledger/v1/blockchain_ledger_v1.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2132,16 +2132,22 @@ process_poc_proposals(BlockHeight, BlockHash, Ledger) ->
%% Mark the selected POCs as active on ledger
case blockchain:config(?poc_challenge_rate, Ledger) of
{ok, K} ->

K2 =
case blockchain:config(?poc_hardcode_poc_selection_count, Ledger) of
{ok, V} -> V;
_ -> K
end,
ProposalGCWindowCheck =
case blockchain:config(?poc_proposal_gc_window_check, Ledger) of
{ok, V} -> V;
{ok, V2} -> V2;
_ -> false
end,
{ok, POCValKeyProposalTimeout} = blockchain:config(?poc_validator_ephemeral_key_timeout, Ledger),
RandState = blockchain_utils:rand_state(BlockHash),
{Name, DB, CF} = proposed_pocs_cf(Ledger),
{ok, Itr} = rocksdb:iterator(DB, CF, []),
POCSubset = promote_proposals(K, BlockHash, BlockHeight, POCValKeyProposalTimeout,
POCSubset = promote_proposals(K2, BlockHash, BlockHeight, POCValKeyProposalTimeout,
ProposalGCWindowCheck, RandState, Ledger, Name, Itr, []),
catch rocksdb:iterator_close(Itr),
lager:debug("Selected POCs ~p", [POCSubset]),
Expand Down
3 changes: 3 additions & 0 deletions src/transactions/v1/blockchain_txn_vars_v1.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,9 @@ validate_var(?poc_targeting_version, Value) ->
_ ->
throw({error, {invalid_poc_targeting_version, Value}})
end;
validate_var(?poc_hardcode_poc_selection_count, Value) ->
validate_int(Value, "poc_hardcode_poc_selection_count", 1, 500, false);

validate_var(?poc_hexing_type, Value) ->
case Value of
hex_h3dex -> ok;
Expand Down

0 comments on commit 0d330f7

Please sign in to comment.