Skip to content

Commit

Permalink
back to normal plot filter
Browse files Browse the repository at this point in the history
  • Loading branch information
madMAx43v3r committed Nov 11, 2023
1 parent f83cec1 commit 7e4248c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
21 changes: 2 additions & 19 deletions include/mmx/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,30 +107,13 @@ bool check_tx_inclusion(const hash_t& txid, const uint32_t height)
}

inline
bool check_plot_filter_single(
bool check_plot_filter(
std::shared_ptr<const ChainParams> params, const hash_t& challenge, const hash_t& plot_id)
{
const hash_t hash(std::string("plot_filter") + plot_id + challenge);
return (hash.to_uint256() >> (256 - params->plot_filter)) == 0;
}

inline
bool check_plot_filter_cycle(
std::shared_ptr<const ChainParams> params, const hash_t& diff_challenge, const hash_t& plot_id, const uint32_t height)
{
const hash_t hash(std::string("plot_filter_cycle") + plot_id + diff_challenge);
return uint32_t(hash.to_uint256() >> (256 - params->plot_filter_cycle)) == (height & ((uint32_t(1) << params->plot_filter_cycle) - 1));
}

inline
bool check_plot_filter(
std::shared_ptr<const ChainParams> params, const hash_t& diff_challenge,
const hash_t& vdf_challenge, const hash_t& plot_id, const uint32_t height)
{
return check_plot_filter_cycle(params, diff_challenge, plot_id, height)
&& check_plot_filter_single(params, vdf_challenge, plot_id);
}

inline
hash_t get_plot_challenge(const hash_t& challenge, const hash_t& plot_id)
{
Expand All @@ -146,7 +129,7 @@ uint64_t to_effective_space(const uint64_t& num_bytes)
inline
uint64_t calc_total_netspace_ideal(std::shared_ptr<const ChainParams> params, const uint64_t space_diff)
{
const auto plot_filter = params->plot_filter + params->plot_filter_cycle;
const auto plot_filter = params->plot_filter;
return ((uint256_t(space_diff) * params->space_diff_constant) << (plot_filter + params->score_bits)) / params->score_target;
}

Expand Down
7 changes: 3 additions & 4 deletions interface/ChainParams.vni
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ class ChainParams {

uint port;
int decimals = 6;
uint min_ksize = 30;
uint max_ksize = 60;
uint plot_filter = 9;
uint plot_filter_cycle = 4;
uint min_ksize = 26;
uint max_ksize = 32;
uint plot_filter = 8; // log2

uint commit_delay = 18; // for writing to disk (should be less than challenge_interval - challenge_delay)
uint infuse_delay = 6; // for primary VDF infusion
Expand Down

0 comments on commit 7e4248c

Please sign in to comment.