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

Commit 0d330f7

Browse files
committed
add override for select proposal count
1 parent ce5f544 commit 0d330f7

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

include/blockchain_vars.hrl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@
181181
%% when determining if a GW is active or inactive: boolean
182182
-define(harmonize_activity_on_hip17_interactivity_blocks, harmonize_activity_on_hip17_interactivity_blocks).
183183

184+
-define(poc_hardcode_poc_selection_count, poc_hardcode_poc_selection_count).
185+
184186
%% Number of blocks to wait before a hotspot can be eligible to participate in a poc
185187
%% challenge. This would avoid new hotspots getting challenged before they sync to an
186188
%% acceptable height.

src/ledger/v1/blockchain_ledger_v1.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,16 +2132,22 @@ process_poc_proposals(BlockHeight, BlockHash, Ledger) ->
21322132
%% Mark the selected POCs as active on ledger
21332133
case blockchain:config(?poc_challenge_rate, Ledger) of
21342134
{ok, K} ->
2135+
2136+
K2 =
2137+
case blockchain:config(?poc_hardcode_poc_selection_count, Ledger) of
2138+
{ok, V} -> V;
2139+
_ -> K
2140+
end,
21352141
ProposalGCWindowCheck =
21362142
case blockchain:config(?poc_proposal_gc_window_check, Ledger) of
2137-
{ok, V} -> V;
2143+
{ok, V2} -> V2;
21382144
_ -> false
21392145
end,
21402146
{ok, POCValKeyProposalTimeout} = blockchain:config(?poc_validator_ephemeral_key_timeout, Ledger),
21412147
RandState = blockchain_utils:rand_state(BlockHash),
21422148
{Name, DB, CF} = proposed_pocs_cf(Ledger),
21432149
{ok, Itr} = rocksdb:iterator(DB, CF, []),
2144-
POCSubset = promote_proposals(K, BlockHash, BlockHeight, POCValKeyProposalTimeout,
2150+
POCSubset = promote_proposals(K2, BlockHash, BlockHeight, POCValKeyProposalTimeout,
21452151
ProposalGCWindowCheck, RandState, Ledger, Name, Itr, []),
21462152
catch rocksdb:iterator_close(Itr),
21472153
lager:debug("Selected POCs ~p", [POCSubset]),

src/transactions/v1/blockchain_txn_vars_v1.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,9 @@ validate_var(?poc_targeting_version, Value) ->
11321132
_ ->
11331133
throw({error, {invalid_poc_targeting_version, Value}})
11341134
end;
1135+
validate_var(?poc_hardcode_poc_selection_count, Value) ->
1136+
validate_int(Value, "poc_hardcode_poc_selection_count", 1, 500, false);
1137+
11351138
validate_var(?poc_hexing_type, Value) ->
11361139
case Value of
11371140
hex_h3dex -> ok;

0 commit comments

Comments
 (0)