diff options
| author | stoffu <stoffu@protonmail.ch> | 2020-05-15 10:56:23 +0900 |
|---|---|---|
| committer | stoffu <stoffu@protonmail.ch> | 2020-06-09 10:40:51 +0900 |
| commit | 7bd66b01bfb62ecaf8ff02b20d14db3a77322abc (patch) | |
| tree | c6a4db2a82193471570360734f4c4955271a69ba /src/cryptonote_core/cryptonote_core.h | |
| parent | ff4d4706292a9cabdd62f0cf6fb06a600cbcf24b (diff) | |
| download | monzero-core-7bd66b01bfb62ecaf8ff02b20d14db3a77322abc.tar.gz monzero-core-7bd66b01bfb62ecaf8ff02b20d14db3a77322abc.tar.xz monzero-core-7bd66b01bfb62ecaf8ff02b20d14db3a77322abc.zip | |
daemon: guard against rare 'difficulty drift' bug with checkpoints and recalculation
On startup, it checks against the difficulty checkpoints, and if any mismatch is found, recalculates all the blocks with wrong difficulties. Additionally, once a week it recalculates difficulties of blocks after the last difficulty checkpoint.
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.h')
| -rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 988f25ceb..5cbec7d62 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -1040,6 +1040,13 @@ namespace cryptonote */ bool check_block_rate(); + /** + * @brief recalculate difficulties after the last difficulty checklpoint to circumvent the annoying 'difficulty drift' bug + * + * @return true + */ + bool recalculate_difficulties(); + bool m_test_drop_download = true; //!< whether or not to drop incoming blocks (for testing) uint64_t m_test_drop_download_height = 0; //!< height under which to drop incoming blocks, if doing so @@ -1065,6 +1072,7 @@ namespace cryptonote epee::math_helper::once_a_time_seconds<60*10, true> m_check_disk_space_interval; //!< interval for checking for disk space epee::math_helper::once_a_time_seconds<90, false> m_block_rate_interval; //!< interval for checking block rate epee::math_helper::once_a_time_seconds<60*60*5, true> m_blockchain_pruning_interval; //!< interval for incremental blockchain pruning + epee::math_helper::once_a_time_seconds<60*60*24*7, false> m_diff_recalc_interval; //!< interval for recalculating difficulties std::atomic<bool> m_starter_message_showed; //!< has the "daemon will sync now" message been shown? |
