Skip to content

Commit 501bb1c

Browse files
committed
Clean up index logging
* don't log function name * take into account that GetName() always ends with " index"
1 parent 05ae68e commit 501bb1c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/index/base.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}
@@ -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 index %s to a previous chain tip", GetName());
225225
return;
226226
}
227227
pindex = pindex_next;
@@ -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\n", GetName());
270270
return false;
271271
}
272272
return true;
@@ -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 "
350+
LogPrintf("WARNING: Block %s does not connect to an ancestor of "
351351
"known best chain (tip=%s); not updating index\n",
352-
__func__, pindex->GetBlockHash().ToString(),
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 index %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 "
405+
LogPrintf("WARNING: Locator contains block (hash=%s) not on known best "
406406
"chain (tip=%s); not writing index locator\n",
407-
__func__, locator_tip_hash.ToString(),
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+
LogPrintf("%s is catching up on block notifications\n", GetName());
438438
m_chain->context()->validation_signals->SyncWithValidationInterfaceQueue();
439439
return true;
440440
}

0 commit comments

Comments
 (0)