diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-11-16 11:16:49 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-11-16 11:16:49 +0200 |
commit | c37c70f4593274e7191392ff038f6ae33f8ebe5a (patch) | |
tree | 5fc7f0403336a8984aefd624b2fb8cacc0776f96 /src/cryptonote_core | |
parent | Merge pull request #4805 (diff) | |
parent | blockchain: fix innocuous difficulty cache inconsistency (diff) | |
download | monero-c37c70f4593274e7191392ff038f6ae33f8ebe5a.tar.xz |
Merge pull request #4806
ac23b10f blockchain: fix innocuous difficulty cache inconsistency (moneromooo-monero)
3b14d972 blockchain: use uint64_t for block height, not size_t (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 19cc90b61..f3105114e 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -831,6 +831,7 @@ difficulty_type Blockchain::get_difficulty_for_next_block() std::vector<uint64_t> timestamps; std::vector<difficulty_type> difficulties; auto height = m_db->height(); + top_hash = get_tail_id(); // get it again now that we have the lock // ND: Speedup // 1. Keep a list of the last 735 (or less) blocks that is used to compute difficulty, // then when the next block difficulty is queried, push the latest height data and @@ -853,7 +854,7 @@ difficulty_type Blockchain::get_difficulty_for_next_block() } else { - size_t offset = height - std::min < size_t > (height, static_cast<size_t>(DIFFICULTY_BLOCKS_COUNT)); + uint64_t offset = height - std::min <uint64_t> (height, static_cast<uint64_t>(DIFFICULTY_BLOCKS_COUNT)); if (offset == 0) ++offset; |