Skip to content

Commit

Permalink
blockchain: fix logging bad number of blocks if first one fails
Browse files Browse the repository at this point in the history
  • Loading branch information
moneromooo-monero committed Aug 28, 2019
1 parent 8501481 commit 11f13da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cryptonote_core/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ bool Blockchain::deinit()
// It starts a batch and calls private method pop_block_from_blockchain().
void Blockchain::pop_blocks(uint64_t nblocks)
{
uint64_t i;
uint64_t i = 0;
CRITICAL_REGION_LOCAL(m_tx_pool);
CRITICAL_REGION_LOCAL1(m_blockchain_lock);

Expand All @@ -627,9 +627,10 @@ void Blockchain::pop_blocks(uint64_t nblocks)
const uint64_t blockchain_height = m_db->height();
if (blockchain_height > 0)
nblocks = std::min(nblocks, blockchain_height - 1);
for (i=0; i < nblocks; ++i)
while (i < nblocks)
{
pop_block_from_blockchain();
++i;
}
}
catch (const std::exception& e)
Expand Down

0 comments on commit 11f13da

Please sign in to comment.