aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/index/base.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp
index b4bda2fca6..eb7de2ea0a 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -174,20 +174,6 @@ void BaseIndex::Sync()
pindex = pindex_next;
- auto current_time{std::chrono::steady_clock::now()};
- if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
- LogPrintf("Syncing %s with block chain from height %d\n",
- GetName(), pindex->nHeight);
- last_log_time = current_time;
- }
-
- if (last_locator_write_time + SYNC_LOCATOR_WRITE_INTERVAL < current_time) {
- SetBestBlockIndex(pindex->pprev);
- last_locator_write_time = current_time;
- // No need to handle errors in Commit. See rationale above.
- Commit();
- }
-
CBlock block;
interfaces::BlockInfo block_info = kernel::MakeBlockInfo(pindex);
if (!m_chainstate->m_blockman.ReadBlockFromDisk(block, *pindex)) {
@@ -202,6 +188,20 @@ void BaseIndex::Sync()
__func__, pindex->GetBlockHash().ToString());
return;
}
+
+ auto current_time{std::chrono::steady_clock::now()};
+ if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
+ LogPrintf("Syncing %s with block chain from height %d\n",
+ GetName(), pindex->nHeight);
+ last_log_time = current_time;
+ }
+
+ if (last_locator_write_time + SYNC_LOCATOR_WRITE_INTERVAL < current_time) {
+ SetBestBlockIndex(pindex);
+ last_locator_write_time = current_time;
+ // No need to handle errors in Commit. See rationale above.
+ Commit();
+ }
}
}