@@ -177,20 +177,6 @@ void BaseIndex::ThreadSync()
177
177
pindex = pindex_next;
178
178
}
179
179
180
- auto current_time{std::chrono::steady_clock::now ()};
181
- if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
182
- LogPrintf (" Syncing %s with block chain from height %d\n " ,
183
- GetName (), pindex->nHeight );
184
- last_log_time = current_time;
185
- }
186
-
187
- if (last_locator_write_time + SYNC_LOCATOR_WRITE_INTERVAL < current_time) {
188
- SetBestBlockIndex (pindex->pprev );
189
- last_locator_write_time = current_time;
190
- // No need to handle errors in Commit. See rationale above.
191
- Commit ();
192
- }
193
-
194
180
CBlock block;
195
181
interfaces::BlockInfo block_info = kernel::MakeBlockInfo (pindex);
196
182
if (!m_chainstate->m_blockman .ReadBlockFromDisk (block, *pindex)) {
@@ -205,6 +191,20 @@ void BaseIndex::ThreadSync()
205
191
__func__, pindex->GetBlockHash ().ToString ());
206
192
return ;
207
193
}
194
+
195
+ auto current_time{std::chrono::steady_clock::now ()};
196
+ if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
197
+ LogPrintf (" Syncing %s with block chain from height %d\n " ,
198
+ GetName (), pindex->nHeight );
199
+ last_log_time = current_time;
200
+ }
201
+
202
+ if (last_locator_write_time + SYNC_LOCATOR_WRITE_INTERVAL < current_time) {
203
+ SetBestBlockIndex (pindex);
204
+ last_locator_write_time = current_time;
205
+ // No need to handle errors in Commit. See rationale above.
206
+ Commit ();
207
+ }
208
208
}
209
209
}
210
210
0 commit comments