From 3b14d9727b6683dc9cd15352254e126e030250d8 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 5 Nov 2018 14:43:35 +0000 Subject: blockchain: use uint64_t for block height, not size_t for consistency --- src/cryptonote_core/blockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 77b6d0b69..e69ea6b08 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -853,7 +853,7 @@ difficulty_type Blockchain::get_difficulty_for_next_block() } else { - size_t offset = height - std::min < size_t > (height, static_cast(DIFFICULTY_BLOCKS_COUNT)); + uint64_t offset = height - std::min (height, static_cast(DIFFICULTY_BLOCKS_COUNT)); if (offset == 0) ++offset; -- cgit v1.2.3 From ac23b10f152b483116419418c4cb11849285cf92 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 5 Nov 2018 14:43:58 +0000 Subject: blockchain: fix innocuous difficulty cache inconsistency This inconsistent state would not actually be used in practice --- src/cryptonote_core/blockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index e69ea6b08..82f8579b1 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 timestamps; std::vector 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 -- cgit v1.2.3