aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authorHoward Chu <highlandsun@gmail.com>2017-01-14 11:28:17 -0800
committerHoward Chu <hyc@symas.com>2017-01-14 22:43:06 +0000
commiteaf8470b293c65140b135829d65422208aa29c44 (patch)
tree92c0d3a84e34956d32d4d62a87e560c913a0950a /src/cryptonote_core/blockchain.cpp
parentDon't cache block height, always get from DB (diff)
downloadmonero-eaf8470b293c65140b135829d65422208aa29c44.tar.xz
Must wait for previous batch to finish before starting new one
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index b4ed06bc0..c368d7b24 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -3544,12 +3544,17 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::list<block_complete_e
{
LOG_PRINT_YELLOW("Blockchain::" << __func__, LOG_LEVEL_3);
TIME_MEASURE_START(prepare);
+ bool stop_batch;
CRITICAL_REGION_LOCAL(m_blockchain_lock);
if(blocks_entry.size() == 0)
return false;
- m_db->batch_start(blocks_entry.size());
+ while (!(stop_batch = m_db->batch_start(blocks_entry.size()))) {
+ m_blockchain_lock.unlock();
+ epee::misc_utils::sleep_no_w(1000);
+ m_blockchain_lock.lock();
+ }
if ((m_db->height() + blocks_entry.size()) < m_blocks_hash_check.size())
return true;