aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-09-14 13:07:35 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-09-14 13:07:35 -0500
commit4a39e1a4a5f8f2cebd4f53f6cdb509c48a2b65e6 (patch)
tree2c18ad5e479660439e44fb16eef74a7ad0c4481c /src/cryptonote_core
parentMerge pull request #5854 (diff)
parentsimplewallet: fix warnings about useless std::move (diff)
downloadmonero-4a39e1a4a5f8f2cebd4f53f6cdb509c48a2b65e6.tar.xz
Merge pull request #5865
11f13da blockchain: fix logging bad number of blocks if first one fails (moneromooo-monero) 19bfe7e simplewallet: fix warnings about useless std::move (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/blockchain.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 0e3edb8e1..798a73c4f 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -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);
@@ -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)