aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-01-02 22:18:52 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-01-02 22:19:54 +0000
commit1e27f7101ed338ede193f23126b4e4fb404676f3 (patch)
treef804b07ea03d6bf2aaeb309a1cc404ec0a7df5a3 /src/cryptonote_core/blockchain.cpp
parentMerge pull request #7250 (diff)
downloadmonero-1e27f7101ed338ede193f23126b4e4fb404676f3.tar.xz
blockchain: lock access to m_blocks_hash_of_hashes
it is accessed both when adding and when prevalidating a set of new hashes from a peer
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 03a9ce6d6..8ec624254 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -4728,6 +4728,8 @@ uint64_t Blockchain::prevalidate_block_hashes(uint64_t height, const std::vector
CHECK_AND_ASSERT_MES(weights.empty() || weights.size() == hashes.size(), 0, "Unexpected weights size");
+ CRITICAL_REGION_LOCAL(m_blockchain_lock);
+
// easy case: height >= hashes
if (height >= m_blocks_hash_of_hashes.size() * HASH_OF_HASHES_STEP)
return hashes.size();