mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
log: Use LogError for fatal errors
This commit is contained in:
@@ -1196,7 +1196,7 @@ bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws)
|
||||
script_verify_flags currentBlockScriptVerifyFlags{GetBlockScriptFlags(*m_active_chainstate.m_chain.Tip(), m_active_chainstate.m_chainman)};
|
||||
if (!CheckInputsFromMempoolAndCache(tx, state, m_view, m_pool, currentBlockScriptVerifyFlags,
|
||||
ws.m_precomputed_txdata, m_active_chainstate.CoinsTip(), GetValidationCache())) {
|
||||
LogPrintf("BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s\n", hash.ToString(), state.ToString());
|
||||
LogError("BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s", hash.ToString(), state.ToString());
|
||||
return Assume(false);
|
||||
}
|
||||
|
||||
@@ -3378,8 +3378,8 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
|
||||
// Belt-and-suspenders check that we aren't attempting to advance the background
|
||||
// chainstate past the snapshot base block.
|
||||
if (WITH_LOCK(::cs_main, return m_disabled)) {
|
||||
LogPrintf("m_disabled is set - this chainstate should not be in operation. "
|
||||
"Please report this as a bug. %s\n", CLIENT_BUGREPORT);
|
||||
LogError("m_disabled is set - this chainstate should not be in operation. "
|
||||
"Please report this as a bug. %s", CLIENT_BUGREPORT);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4702,12 +4702,12 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
CBlock block;
|
||||
// check level 0: read from disk
|
||||
if (!chainstate.m_blockman.ReadBlock(block, *pindex)) {
|
||||
LogPrintf("Verification error: ReadBlock failed at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
LogError("Verification error: ReadBlock failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
// check level 1: verify block validity
|
||||
if (nCheckLevel >= 1 && !CheckBlock(block, state, consensus_params)) {
|
||||
LogPrintf("Verification error: found bad block at %d, hash=%s (%s)\n",
|
||||
LogError("Verification error: found bad block at %d, hash=%s (%s)",
|
||||
pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
@@ -4716,7 +4716,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
CBlockUndo undo;
|
||||
if (!pindex->GetUndoPos().IsNull()) {
|
||||
if (!chainstate.m_blockman.ReadBlockUndo(undo, *pindex)) {
|
||||
LogPrintf("Verification error: found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
LogError("Verification error: found bad undo data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
}
|
||||
@@ -4729,7 +4729,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
assert(coins.GetBestBlock() == pindex->GetBlockHash());
|
||||
DisconnectResult res = chainstate.DisconnectBlock(block, pindex, coins);
|
||||
if (res == DISCONNECT_FAILED) {
|
||||
LogPrintf("Verification error: irrecoverable inconsistency in block data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
LogError("Verification error: irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
if (res == DISCONNECT_UNCLEAN) {
|
||||
@@ -4745,7 +4745,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
if (chainstate.m_chainman.m_interrupt) return VerifyDBResult::INTERRUPTED;
|
||||
}
|
||||
if (pindexFailure) {
|
||||
LogPrintf("Verification error: coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainstate.m_chain.Height() - pindexFailure->nHeight + 1, nGoodTransactions);
|
||||
LogError("Verification error: coin database inconsistencies found (last %i blocks, %i good transactions before that)", chainstate.m_chain.Height() - pindexFailure->nHeight + 1, nGoodTransactions);
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
if (skipped_l3_checks) {
|
||||
@@ -4768,11 +4768,11 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
pindex = chainstate.m_chain.Next(pindex);
|
||||
CBlock block;
|
||||
if (!chainstate.m_blockman.ReadBlock(block, *pindex)) {
|
||||
LogPrintf("Verification error: ReadBlock failed at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
LogError("Verification error: ReadBlock failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
if (!chainstate.ConnectBlock(block, state, pindex, coins)) {
|
||||
LogPrintf("Verification error: found unconnectable block at %d, hash=%s (%s)\n", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
|
||||
LogError("Verification error: found unconnectable block at %d, hash=%s (%s)", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
|
||||
return VerifyDBResult::CORRUPTED_BLOCK_DB;
|
||||
}
|
||||
if (chainstate.m_chainman.m_interrupt) return VerifyDBResult::INTERRUPTED;
|
||||
@@ -5635,7 +5635,7 @@ Chainstate& ChainstateManager::InitializeChainstate(CTxMemPool* mempool)
|
||||
const bool destroyed = DestroyDB(path_str);
|
||||
|
||||
if (!destroyed) {
|
||||
LogPrintf("error: leveldb DestroyDB call failed on %s\n", path_str);
|
||||
LogError("leveldb DestroyDB call failed on %s", path_str);
|
||||
}
|
||||
|
||||
// Datadir should be removed from filesystem; otherwise initialization may detect
|
||||
@@ -6334,8 +6334,8 @@ util::Result<void> Chainstate::InvalidateCoinsDBOnDisk()
|
||||
auto src_str = fs::PathToString(snapshot_datadir);
|
||||
auto dest_str = fs::PathToString(invalid_path);
|
||||
|
||||
LogPrintf("%s: error renaming file '%s' -> '%s': %s\n",
|
||||
__func__, src_str, dest_str, e.what());
|
||||
LogError("While invalidating the coins db: Error renaming file '%s' -> '%s': %s",
|
||||
src_str, dest_str, e.what());
|
||||
return util::Error{strprintf(_(
|
||||
"Rename of '%s' -> '%s' failed. "
|
||||
"You should resolve this by manually moving or deleting the invalid "
|
||||
@@ -6354,7 +6354,7 @@ bool ChainstateManager::DeleteSnapshotChainstate()
|
||||
|
||||
fs::path snapshot_datadir = Assert(node::FindSnapshotChainstateDir(m_options.datadir)).value();
|
||||
if (!DeleteCoinsDBFromDisk(snapshot_datadir, /*is_snapshot=*/ true)) {
|
||||
LogPrintf("Deletion of %s failed. Please remove it manually to continue reindexing.\n",
|
||||
LogError("Deletion of %s failed. Please remove it manually to continue reindexing.",
|
||||
fs::PathToString(snapshot_datadir));
|
||||
return false;
|
||||
}
|
||||
@@ -6416,8 +6416,8 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
|
||||
// is in-memory, in which case we can't do on-disk cleanup. You'd better be
|
||||
// in a unittest!
|
||||
if (!ibd_chainstate_path_maybe || !snapshot_chainstate_path_maybe) {
|
||||
LogPrintf("[snapshot] snapshot chainstate cleanup cannot happen with "
|
||||
"in-memory chainstates. You are testing, right?\n");
|
||||
LogError("[snapshot] snapshot chainstate cleanup cannot happen with "
|
||||
"in-memory chainstates. You are testing, right?");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user