reset, revert difficulty algorithm, set fork height

This commit is contained in:
wowario 2021-05-24 21:53:45 +03:00
parent 707bfe86ad
commit 9cd125b345
5 changed files with 9 additions and 4 deletions

View file

@ -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.

View file

@ -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());

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 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

View file

@ -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<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);
@ -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);

View file

@ -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]);