@@ -112,7 +112,7 @@ bool BaseIndex::Init()
112112 // best chain, we will rewind to the fork point during index sync
113113 const CBlockIndex* locator_index{m_chainstate->m_blockman .LookupBlockIndex (locator.vHave .at (0 ))};
114114 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 ())));
116116 }
117117 SetBestBlockIndex (locator_index);
118118 }
@@ -156,8 +156,8 @@ bool BaseIndex::ProcessBlock(const CBlockIndex* pindex, const CBlock* block_data
156156 CBlock block;
157157 if (!block_data) { // disk lookup if block data wasn't provided
158158 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 ());
161161 return false ;
162162 }
163163 block_info.data = █
@@ -166,16 +166,16 @@ bool BaseIndex::ProcessBlock(const CBlockIndex* pindex, const CBlock* block_data
166166 CBlockUndo block_undo;
167167 if (CustomOptions ().connect_undo_data ) {
168168 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 ());
171171 return false ;
172172 }
173173 block_info.undo_data = &block_undo;
174174 }
175175
176176 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 ());
179179 return false ;
180180 }
181181
@@ -190,7 +190,7 @@ void BaseIndex::Sync()
190190 std::chrono::steady_clock::time_point last_locator_write_time{0s};
191191 while (true ) {
192192 if (m_interrupt) {
193- LogPrintf (" %s: m_interrupt set; exiting ThreadSync\n " , GetName ());
193+ LogInfo (" %s: m_interrupt set; exiting ThreadSync" , GetName ());
194194
195195 SetBestBlockIndex (pindex);
196196 // No need to handle errors in Commit. If it fails, the error will be already be
@@ -221,7 +221,7 @@ void BaseIndex::Sync()
221221 }
222222 }
223223 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 ());
225225 return ;
226226 }
227227 pindex = pindex_next;
@@ -231,7 +231,7 @@ void BaseIndex::Sync()
231231
232232 auto current_time{std::chrono::steady_clock::now ()};
233233 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" ,
235235 GetName (), pindex->nHeight );
236236 last_log_time = current_time;
237237 }
@@ -246,9 +246,9 @@ void BaseIndex::Sync()
246246 }
247247
248248 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 );
250250 } else {
251- LogPrintf (" %s is enabled\n " , GetName ());
251+ LogInfo (" %s is enabled" , GetName ());
252252 }
253253}
254254
@@ -266,7 +266,7 @@ bool BaseIndex::Commit()
266266 }
267267 }
268268 if (!ok) {
269- LogError (" %s: Failed to commit latest %s state\n " , __func__ , GetName ());
269+ LogError (" Failed to commit latest %s state" , GetName ());
270270 return false ;
271271 }
272272 return true ;
@@ -284,8 +284,8 @@ bool BaseIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_ti
284284 interfaces::BlockInfo block_info = kernel::MakeBlockInfo (iter_tip);
285285 if (CustomOptions ().disconnect_data ) {
286286 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 ());
289289 return false ;
290290 }
291291 block_info.data = █
@@ -336,8 +336,8 @@ void BaseIndex::BlockConnected(ChainstateRole role, const std::shared_ptr<const
336336 const CBlockIndex* best_block_index = m_best_block_index.load ();
337337 if (!best_block_index) {
338338 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 );
341341 return ;
342342 }
343343 } else {
@@ -347,15 +347,15 @@ void BaseIndex::BlockConnected(ChainstateRole role, const std::shared_ptr<const
347347 // in the ValidationInterface queue backlog even after the sync thread has caught up to the
348348 // new chain tip. In this unlikely event, log a warning and let the queue clear.
349349 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 (),
353353 best_block_index->GetBlockHash ().ToString ());
354354 return ;
355355 }
356356 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 ());
359359 return ;
360360 }
361361 }
@@ -390,8 +390,8 @@ void BaseIndex::ChainStateFlushed(ChainstateRole role, const CBlockLocator& loca
390390 }
391391
392392 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 ());
395395 return ;
396396 }
397397
@@ -402,9 +402,9 @@ void BaseIndex::ChainStateFlushed(ChainstateRole role, const CBlockLocator& loca
402402 // event, log a warning and let the queue clear.
403403 const CBlockIndex* best_block_index = m_best_block_index.load ();
404404 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 (),
408408 best_block_index->GetBlockHash ().ToString ());
409409 return ;
410410 }
@@ -434,7 +434,7 @@ bool BaseIndex::BlockUntilSyncedToCurrentChain() const
434434 }
435435 }
436436
437- LogPrintf (" %s: %s is catching up on block notifications\n " , __func__ , GetName ());
437+ LogInfo (" %s is catching up on block notifications" , GetName ());
438438 m_chain->context ()->validation_signals ->SyncWithValidationInterfaceQueue ();
439439 return true ;
440440}
0 commit comments