diff options
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 39bf39df3..37ff4248e 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -623,11 +623,10 @@ difficulty_type Blockchain::get_difficulty_for_next_block() size_t offset = h - std::min(h, static_cast<size_t>(DIFFICULTY_BLOCKS_COUNT)); - // because BlockchainDB::height() returns the index of the top block, the - // first index we need to get needs to be one - // higher than height() - DIFFICULTY_BLOCKS_COUNT. This also conveniently - // makes sure we don't use the genesis block. - ++offset; + if (offset == 0) + { + ++offset; + } for(; offset < h; offset++) { |