diff --git a/include/blockchain_vars.hrl b/include/blockchain_vars.hrl index 46f1ec3684..cbf84f451b 100644 --- a/include/blockchain_vars.hrl +++ b/include/blockchain_vars.hrl @@ -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. diff --git a/src/ledger/v1/blockchain_ledger_v1.erl b/src/ledger/v1/blockchain_ledger_v1.erl index 403504159a..7a796b254a 100644 --- a/src/ledger/v1/blockchain_ledger_v1.erl +++ b/src/ledger/v1/blockchain_ledger_v1.erl @@ -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]), diff --git a/src/transactions/v1/blockchain_txn_vars_v1.erl b/src/transactions/v1/blockchain_txn_vars_v1.erl index ed7ae20ab0..8b08cdb6a0 100644 --- a/src/transactions/v1/blockchain_txn_vars_v1.erl +++ b/src/transactions/v1/blockchain_txn_vars_v1.erl @@ -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;