adjust difficulty_blocks_count

wonerujo-v0.10.1
wowario 3 years ago
parent 40e30964c4
commit 118cbd043a

@ -67,7 +67,7 @@ If you have a fix or code change, feel free to submit it as a pull request. Ahea
Things to Do, Work in Progress, and Help Wanted tasks are tracked in the [Meta](https://git.wownero.com/wownero/meta/issues) repo. Things to Do, Work in Progress, and Help Wanted tasks are tracked in the [Meta](https://git.wownero.com/wownero/meta/issues) repo.
Join `#wownero-dev` on IRC freenode to participate in development conversation. Join `#wownero-dev` on IRC OFTC to participate in development conversation.
## Scheduled software upgrades ## Scheduled software upgrades

@ -215,7 +215,7 @@ namespace cryptonote {
if (length <= 1) { if (length <= 1) {
return 1; return 1;
} }
if (HEIGHT < 200 && HEIGHT > 2 && m_nettype == TESTNET) { return 500; } if (HEIGHT < 10 && HEIGHT > 2 && m_nettype == TESTNET) { return 500; }
if (HEIGHT <= 55 + DIFFICULTY_WINDOW && HEIGHT >= 55 && m_nettype == TESTNET) { return 1337; } if (HEIGHT <= 55 + DIFFICULTY_WINDOW && HEIGHT >= 55 && m_nettype == TESTNET) { return 1337; }
if (HEIGHT <= DIFFICULTY_RESET_HEIGHT + DIFFICULTY_WINDOW && HEIGHT >= DIFFICULTY_RESET_HEIGHT && m_nettype == MAINNET) { return DIFFICULTY_RESET_LEVEL; } 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"); static_assert(DIFFICULTY_WINDOW >= 2, "Window is too small");

@ -865,7 +865,7 @@ start:
ss << "Re-locked, height " << height << ", tail id " << new_top_hash << (new_top_hash == top_hash ? "" : " (different)") << std::endl; ss << "Re-locked, height " << height << ", tail id " << new_top_hash << (new_top_hash == top_hash ? "" : " (different)") << std::endl;
top_hash = new_top_hash; top_hash = new_top_hash;
uint8_t version = get_current_hard_fork_version(); uint8_t version = get_current_hard_fork_version();
uint64_t difficulty_blocks_count = version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT; uint64_t difficulty_blocks_count = version <= 17 && version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
// ND: Speedup // ND: Speedup
// 1. Keep a list of the last 735 (or less) blocks that is used to compute difficulty, // 1. Keep a list of the last 735 (or less) blocks that is used to compute difficulty,
@ -983,7 +983,7 @@ start:
MGINFO("START DUMP"); MGINFO("START DUMP");
MGINFO(ss.str()); MGINFO(ss.str());
MGINFO("END DUMP"); MGINFO("END DUMP");
MGINFO("Please send wowario on Freenode #wownero-dev the contents of this log, from a couple dozen lines before START DUMP to END DUMP"); MGINFO("Please send wowario on IRC OTFC #wownero-dev the contents of this log, from a couple dozen lines before START DUMP to END DUMP");
} }
return diff; return diff;
} }
@ -1015,7 +1015,7 @@ size_t Blockchain::recalculate_difficulties(boost::optional<uint64_t> start_heig
const uint64_t top_height = m_db->height() - 1; const uint64_t top_height = m_db->height() - 1;
MGINFO("Recalculating difficulties from height " << start_height << " to height " << top_height); MGINFO("Recalculating difficulties from height " << start_height << " to height " << top_height);
uint8_t version = get_current_hard_fork_version(); uint8_t version = get_current_hard_fork_version();
uint64_t difficulty_blocks_count = version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT; uint64_t difficulty_blocks_count = version <= 17 && version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
std::vector<uint64_t> timestamps; std::vector<uint64_t> timestamps;
std::vector<difficulty_type> difficulties; std::vector<difficulty_type> difficulties;
timestamps.reserve(difficulty_blocks_count + 1); timestamps.reserve(difficulty_blocks_count + 1);
@ -1297,7 +1297,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
std::vector<difficulty_type> cumulative_difficulties; std::vector<difficulty_type> cumulative_difficulties;
uint8_t version = get_current_hard_fork_version(); uint8_t version = get_current_hard_fork_version();
size_t difficulty_blocks_count = version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT; size_t difficulty_blocks_count = version <= 17 && version >= 11 ? DIFFICULTY_BLOCKS_COUNT_V3 : version <= 10 && version >= 8 ? DIFFICULTY_BLOCKS_COUNT_V2 : DIFFICULTY_BLOCKS_COUNT;
// if the alt chain isn't long enough to calculate the difficulty target // if the alt chain isn't long enough to calculate the difficulty target
// based on its blocks alone, need to get more blocks from the main chain // based on its blocks alone, need to get more blocks from the main chain

Loading…
Cancel
Save