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/blockchain_db/testdb.h | |
parent | Merge pull request #6576 (diff) | |
download | monero-7bd66b01bfb62ecaf8ff02b20d14db3a77322abc.tar.xz |
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/blockchain_db/testdb.h')
-rw-r--r-- | src/blockchain_db/testdb.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/blockchain_db/testdb.h b/src/blockchain_db/testdb.h index 638dd3b37..da8ce943f 100644 --- a/src/blockchain_db/testdb.h +++ b/src/blockchain_db/testdb.h @@ -82,6 +82,7 @@ public: virtual std::vector<uint64_t> get_block_weights(uint64_t start_height, size_t count) const override { return {}; } virtual cryptonote::difficulty_type get_block_cumulative_difficulty(const uint64_t& height) const override { return 10; } virtual cryptonote::difficulty_type get_block_difficulty(const uint64_t& height) const override { return 0; } + virtual void correct_block_cumulative_difficulties(const uint64_t& start_height, const std::vector<difficulty_type>& new_cumulative_difficulties) override {} virtual uint64_t get_block_already_generated_coins(const uint64_t& height) const override { return 10000000000; } virtual uint64_t get_block_long_term_weight(const uint64_t& height) const override { return 128; } virtual std::vector<uint64_t> get_long_term_block_weights(uint64_t start_height, size_t count) const override { return {}; } |