diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 6b6b775..f1d6df5 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -74,6 +74,7 @@ DISABLE_VS_WARNINGS(4267) // used to overestimate the block reward when estimating a per kB to use #define BLOCK_REWARD_OVERESTIMATE ((uint64_t)(16000000000)) +#define MAINNET_HARDFORK_V3_HEIGHT ((uint64_t)(116520)) static const struct { uint8_t version; @@ -83,7 +84,7 @@ static const struct { } mainnet_hard_forks[] = { { 1, 1, 0, 1482806500 }, { 2, 21300, 0, 1497657600 }, - { 3, 116520, 0, 1522800000 } + { 3, MAINNET_HARDFORK_V3_HEIGHT, 0, 1522800000 } }; static const uint64_t mainnet_hard_fork_version_1_till = (uint64_t)-1; @@ -676,6 +677,11 @@ difficulty_type Blockchain::get_difficulty_for_next_block() std::vector timestamps; std::vector difficulties; auto height = m_db->height(); + // Reset network hashrate to 2.0 MHz when hardfork v3 comes + if (!m_testnet && (uint64_t)height >= MAINNET_HARDFORK_V3_HEIGHT && (uint64_t)height <= MAINNET_HARDFORK_V3_HEIGHT + (uint64_t)DIFFICULTY_BLOCKS_COUNT_V2){ + return (difficulty_type) 480000000; + } + size_t difficult_block_count = get_current_hard_fork_version() < 2 ? DIFFICULTY_BLOCKS_COUNT : DIFFICULTY_BLOCKS_COUNT_V2; // ND: Speedup