rest and revert to default diff

This commit is contained in:
wowario 2021-05-24 21:53:45 +03:00
parent 3b13340a30
commit 73a1a3fb8d
4 changed files with 7 additions and 3 deletions

View file

@ -214,6 +214,7 @@ namespace cryptonote {
return 1;
}
if (HEIGHT < 200 && HEIGHT > 2 && m_nettype == TESTNET) { return 500; }
if (HEIGHT <= DIFFICULTY_RESET_HEIGHT + DIFFICULTY_WINDOW && HEIGHT >= DIFFICULTY_RESET_HEIGHT && m_nettype == MAINNET) { return DIFFICULTY_RESET_LEVEL; }
static_assert(DIFFICULTY_WINDOW >= 2, "Window is too small");
assert(length <= DIFFICULTY_WINDOW);
sort(timestamps.begin(), timestamps.end());

View file

@ -87,6 +87,8 @@
#define DIFFICULTY_BLOCKS_COUNT_V3 DIFFICULTY_WINDOW_V3 + 1 // added +1 to make N=N
#define DIFFICULTY_BLOCKS_COUNT_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
#define DIFFICULTY_RESET_HEIGHT 331519 // ~July 4, 2021 Pool Independence Day
#define DIFFICULTY_RESET_LEVEL 100000000 // 100 mill
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS

View file

@ -948,7 +948,7 @@ start:
difficulty_type diff = next_difficulty(timestamps, m_nettype, difficulties, target, HEIGHT);
if (version >= 11) {
if (version <= 17 && version >= 11) {
diff = next_difficulty_v5(timestamps, m_nettype, difficulties, T, N, HEIGHT);
} else if (version == 10) {
diff = next_difficulty_v4(timestamps, m_nettype, difficulties, HEIGHT);
@ -1043,7 +1043,7 @@ size_t Blockchain::recalculate_difficulties(boost::optional<uint64_t> start_heig
size_t target = get_ideal_hard_fork_version(height) < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET_V2;
difficulty_type recalculated_diff = next_difficulty(timestamps, m_nettype, difficulties, target, HEIGHT);
if (version >= 11) {
if (version <= 17 && version >= 11) {
recalculated_diff = next_difficulty_v5(timestamps, m_nettype, difficulties, T, N, HEIGHT);
} else if (version == 10) {
recalculated_diff = next_difficulty_v4(timestamps, m_nettype, difficulties, HEIGHT);
@ -1357,7 +1357,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
uint64_t HEIGHT = m_db->height();
// calculate the difficulty target for the block and return it
if (version >= 11) {
if (version <= 17 && version >= 11) {
return next_difficulty_v5(timestamps, m_nettype, cumulative_difficulties, T, N, HEIGHT);
} else if (version == 10) {
return next_difficulty_v4(timestamps, m_nettype, cumulative_difficulties, HEIGHT);

View file

@ -43,6 +43,7 @@ const hardfork_t mainnet_hard_forks[] = {
{ 15, 160777, 0, 1573280497 },
{ 16, 253999, 0, 1600576508 },
{ 17, 254287, 0, 1600576524 },
{ 18, 331519, 0, 1623245591 },
};
const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]);