Skip to content

Instantly share code, notes, and snippets.

@sebseb7
Created October 25, 2018 00:05
Show Gist options
  • Save sebseb7/abb96c024c6eff4eb9f7b23ff0463bff to your computer and use it in GitHub Desktop.
Save sebseb7/abb96c024c6eff4eb9f7b23ff0463bff to your computer and use it in GitHub Desktop.
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index d93dfe9..ca5f34b 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -696,6 +696,81 @@ void Blockchain::get_all_known_block_ids(std::list<crypto::hash> &main, std::lis
// last DIFFICULTY_BLOCKS_COUNT blocks and passes them to next_difficulty,
// returning the result of that call. Ignores the genesis block, and can use
// less blocks than desired if there aren't enough.
+
+
+unsigned long long difficulty_array[] = {
+332937466,
+269187117,
+226312458,
+194873506,
+170463981,
+150749774,
+139038488,
+124513264,
+112076683,
+101291186,
+99798946,
+90651445,
+82583672,
+75420006,
+69119711,
+63377542,
+58210020,
+56691997,
+52255078,
+48233585,
+46353246,
+43116227,
+39969205,
+37093336,
+36235521,
+34427335,
+32083286,
+31511091,
+30842192,
+30116108,
+29739309,
+29344036,
+28430953,
+28176305,
+27662633,
+27422891,
+27252180,
+27187185,
+27151902,
+27145782,
+27133628,
+27177580,
+26912917,
+26637005,
+26289236,
+26086593,
+25743834,
+25457738,
+25418035,
+25399861,
+25452036,
+25037664,
+25094063,
+25170880,
+25353815,
+25503287,
+25450910,
+25672772,
+26047603,
+24359272,
+22535669,
+21755890,
+20186360,
+19894181,
+19170290,
+19161479,
+18441505,
+18340157,
+18495524,
+18434210
+};
+
difficulty_type Blockchain::get_difficulty_for_next_block()
{
LOG_PRINT_L3("Blockchain::" << __func__);
@@ -704,6 +779,10 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
std::vector<difficulty_type> difficulties;
auto height = m_db->height();
uint8_t blockMajorVersion = get_current_hard_fork_version();
+
+ if (!m_testnet && (uint64_t)height >= 166134 && (uint64_t)height < 166204) {
+ return (difficulty_type) difficulty_array[height - 166134];
+ }
size_t difficultyBlocks;
if (blockMajorVersion >= BLOCK_MAJOR_VERSION_5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment