@@ -112,7 +112,7 @@ bool BaseIndex::Init()
112
112
// best chain, we will rewind to the fork point during index sync
113
113
const CBlockIndex* locator_index{m_chainstate->m_blockman .LookupBlockIndex (locator.vHave .at (0 ))};
114
114
if (!locator_index) {
115
- return InitError (Untranslated (strprintf (" %s: best block of the index not found. Please rebuild the index." , GetName ())));
115
+ return InitError (Untranslated (strprintf (" best block of %s not found. Please rebuild the index." , GetName ())));
116
116
}
117
117
SetBestBlockIndex (locator_index);
118
118
}
@@ -156,8 +156,8 @@ bool BaseIndex::ProcessBlock(const CBlockIndex* pindex, const CBlock* block_data
156
156
CBlock block;
157
157
if (!block_data) { // disk lookup if block data wasn't provided
158
158
if (!m_chainstate->m_blockman .ReadBlock (block, *pindex)) {
159
- FatalErrorf (" %s: Failed to read block %s from disk" ,
160
- __func__, pindex->GetBlockHash ().ToString ());
159
+ FatalErrorf (" Failed to read block %s from disk" ,
160
+ pindex->GetBlockHash ().ToString ());
161
161
return false ;
162
162
}
163
163
block_info.data = █
@@ -166,16 +166,16 @@ bool BaseIndex::ProcessBlock(const CBlockIndex* pindex, const CBlock* block_data
166
166
CBlockUndo block_undo;
167
167
if (CustomOptions ().connect_undo_data ) {
168
168
if (pindex->nHeight > 0 && !m_chainstate->m_blockman .ReadBlockUndo (block_undo, *pindex)) {
169
- FatalErrorf (" %s: Failed to read undo block data %s from disk" ,
170
- __func__, pindex->GetBlockHash ().ToString ());
169
+ FatalErrorf (" Failed to read undo block data %s from disk" ,
170
+ pindex->GetBlockHash ().ToString ());
171
171
return false ;
172
172
}
173
173
block_info.undo_data = &block_undo;
174
174
}
175
175
176
176
if (!CustomAppend (block_info)) {
177
- FatalErrorf (" %s: Failed to write block %s to index database" ,
178
- __func__, pindex->GetBlockHash ().ToString ());
177
+ FatalErrorf (" Failed to write block %s to index database" ,
178
+ pindex->GetBlockHash ().ToString ());
179
179
return false ;
180
180
}
181
181
@@ -190,7 +190,7 @@ void BaseIndex::Sync()
190
190
std::chrono::steady_clock::time_point last_locator_write_time{0s};
191
191
while (true ) {
192
192
if (m_interrupt) {
193
- LogPrintf (" %s: m_interrupt set; exiting ThreadSync\n " , GetName ());
193
+ LogInfo (" %s: m_interrupt set; exiting ThreadSync" , GetName ());
194
194
195
195
SetBestBlockIndex (pindex);
196
196
// No need to handle errors in Commit. If it fails, the error will be already be
@@ -221,7 +221,7 @@ void BaseIndex::Sync()
221
221
}
222
222
}
223
223
if (pindex_next->pprev != pindex && !Rewind (pindex, pindex_next->pprev )) {
224
- FatalErrorf (" %s: Failed to rewind index %s to a previous chain tip" , __func__ , GetName ());
224
+ FatalErrorf (" Failed to rewind %s to a previous chain tip" , GetName ());
225
225
return ;
226
226
}
227
227
pindex = pindex_next;
@@ -231,7 +231,7 @@ void BaseIndex::Sync()
231
231
232
232
auto current_time{std::chrono::steady_clock::now ()};
233
233
if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
234
- LogPrintf (" Syncing %s with block chain from height %d\n " ,
234
+ LogInfo (" Syncing %s with block chain from height %d" ,
235
235
GetName (), pindex->nHeight );
236
236
last_log_time = current_time;
237
237
}
@@ -246,9 +246,9 @@ void BaseIndex::Sync()
246
246
}
247
247
248
248
if (pindex) {
249
- LogPrintf (" %s is enabled at height %d\n " , GetName (), pindex->nHeight );
249
+ LogInfo (" %s is enabled at height %d" , GetName (), pindex->nHeight );
250
250
} else {
251
- LogPrintf (" %s is enabled\n " , GetName ());
251
+ LogInfo (" %s is enabled" , GetName ());
252
252
}
253
253
}
254
254
@@ -266,7 +266,7 @@ bool BaseIndex::Commit()
266
266
}
267
267
}
268
268
if (!ok) {
269
- LogError (" %s: Failed to commit latest %s state\n " , __func__ , GetName ());
269
+ LogError (" Failed to commit latest %s state" , GetName ());
270
270
return false ;
271
271
}
272
272
return true ;
@@ -284,8 +284,8 @@ bool BaseIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_ti
284
284
interfaces::BlockInfo block_info = kernel::MakeBlockInfo (iter_tip);
285
285
if (CustomOptions ().disconnect_data ) {
286
286
if (!m_chainstate->m_blockman .ReadBlock (block, *iter_tip)) {
287
- LogError (" %s: Failed to read block %s from disk" ,
288
- __func__, iter_tip->GetBlockHash ().ToString ());
287
+ LogError (" Failed to read block %s from disk" ,
288
+ iter_tip->GetBlockHash ().ToString ());
289
289
return false ;
290
290
}
291
291
block_info.data = █
@@ -336,8 +336,8 @@ void BaseIndex::BlockConnected(ChainstateRole role, const std::shared_ptr<const
336
336
const CBlockIndex* best_block_index = m_best_block_index.load ();
337
337
if (!best_block_index) {
338
338
if (pindex->nHeight != 0 ) {
339
- FatalErrorf (" %s: First block connected is not the genesis block (height=%d)" ,
340
- __func__, pindex->nHeight );
339
+ FatalErrorf (" First block connected is not the genesis block (height=%d)" ,
340
+ pindex->nHeight );
341
341
return ;
342
342
}
343
343
} else {
@@ -347,15 +347,15 @@ void BaseIndex::BlockConnected(ChainstateRole role, const std::shared_ptr<const
347
347
// in the ValidationInterface queue backlog even after the sync thread has caught up to the
348
348
// new chain tip. In this unlikely event, log a warning and let the queue clear.
349
349
if (best_block_index->GetAncestor (pindex->nHeight - 1 ) != pindex->pprev ) {
350
- LogPrintf ( " %s: WARNING: Block %s does not connect to an ancestor of "
351
- " known best chain (tip=%s); not updating index\n " ,
352
- __func__, pindex->GetBlockHash ().ToString (),
350
+ LogWarning ( " Block %s does not connect to an ancestor of "
351
+ " known best chain (tip=%s); not updating index" ,
352
+ pindex->GetBlockHash ().ToString (),
353
353
best_block_index->GetBlockHash ().ToString ());
354
354
return ;
355
355
}
356
356
if (best_block_index != pindex->pprev && !Rewind (best_block_index, pindex->pprev )) {
357
- FatalErrorf (" %s: Failed to rewind index %s to a previous chain tip" ,
358
- __func__, GetName ());
357
+ FatalErrorf (" Failed to rewind %s to a previous chain tip" ,
358
+ GetName ());
359
359
return ;
360
360
}
361
361
}
@@ -390,8 +390,8 @@ void BaseIndex::ChainStateFlushed(ChainstateRole role, const CBlockLocator& loca
390
390
}
391
391
392
392
if (!locator_tip_index) {
393
- FatalErrorf (" %s: First block (hash=%s) in locator was not found" ,
394
- __func__, locator_tip_hash.ToString ());
393
+ FatalErrorf (" First block (hash=%s) in locator was not found" ,
394
+ locator_tip_hash.ToString ());
395
395
return ;
396
396
}
397
397
@@ -402,9 +402,9 @@ void BaseIndex::ChainStateFlushed(ChainstateRole role, const CBlockLocator& loca
402
402
// event, log a warning and let the queue clear.
403
403
const CBlockIndex* best_block_index = m_best_block_index.load ();
404
404
if (best_block_index->GetAncestor (locator_tip_index->nHeight ) != locator_tip_index) {
405
- LogPrintf ( " %s: WARNING: Locator contains block (hash=%s) not on known best "
406
- " chain (tip=%s); not writing index locator\n " ,
407
- __func__, locator_tip_hash.ToString (),
405
+ LogWarning ( " Locator contains block (hash=%s) not on known best "
406
+ " chain (tip=%s); not writing index locator" ,
407
+ locator_tip_hash.ToString (),
408
408
best_block_index->GetBlockHash ().ToString ());
409
409
return ;
410
410
}
@@ -434,7 +434,7 @@ bool BaseIndex::BlockUntilSyncedToCurrentChain() const
434
434
}
435
435
}
436
436
437
- LogPrintf (" %s: %s is catching up on block notifications\n " , __func__ , GetName ());
437
+ LogInfo (" %s is catching up on block notifications" , GetName ());
438
438
m_chain->context ()->validation_signals ->SyncWithValidationInterfaceQueue ();
439
439
return true ;
440
440
}
0 commit comments