From 9cd125b34507f02fa705bc4f824c5c82204dc676 Mon Sep 17 00:00:00 2001 From: wowario Date: Mon, 24 May 2021 21:53:45 +0300 Subject: [PATCH] reset, revert difficulty algorithm, set fork height --- README.md | 2 +- src/cryptonote_basic/difficulty.cpp | 1 + src/cryptonote_config.h | 2 ++ src/cryptonote_core/blockchain.cpp | 6 +++--- src/hardforks/hardforks.cpp | 2 ++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0e73c2d39..0dee76302 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Dates are provided in the format YYYY-MM-DD. | 160,777 | 2019-11-20 | Gaping Goatse | v0.7.0.0 | v0.7.1.0 | Only allow >= 2 outputs, change to the block median used to calculate penalty, rct sigs in coinbase forbidden, 4 unlock time as protocol rule | - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support | 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.3.3 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG -| 331,519 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.0.0 | Bulletproofs+, Miner Block Header Signing, Reduce dynamic coinbase unlock time (2 weeks™), Reset difficulty and switch back to Monero's difficulty algorithm +| 331,571 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.0.0 | Bulletproofs+, Miner Block Header Signing, Reduce dynamic coinbase unlock time (2 weeks™), Reset difficulty and switch back to Monero's difficulty algorithm X's indicate that these details have not been determined as of commit date. diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index 8eb446647..8349548d4 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -216,6 +216,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()); diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index c9de55180..37acd2303 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -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 331571 // ~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 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 8066b5395..58ecf528d 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -950,7 +950,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); @@ -1045,7 +1045,7 @@ size_t Blockchain::recalculate_difficulties(boost::optional 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); @@ -1360,7 +1360,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); diff --git a/src/hardforks/hardforks.cpp b/src/hardforks/hardforks.cpp index 49d9a970c..8bb5a4445 100644 --- a/src/hardforks/hardforks.cpp +++ b/src/hardforks/hardforks.cpp @@ -43,6 +43,8 @@ const hardfork_t mainnet_hard_forks[] = { { 15, 160777, 0, 1573280497 }, { 16, 253999, 0, 1600576508 }, { 17, 254287, 0, 1600576524 }, + { 18, 331571, 0, 1623245591 }, + { 19, 331859, 0, 1623693101 }, }; const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]);