aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2023-08-27 13:14:56 +0200
committerFabian Jahr <fjahr@protonmail.com>2023-08-27 20:16:43 +0200
commitdf60de770d8e27c00eced29d8a4a4bce7c6e4b30 (patch)
treeeb4bb365c7527b207e8ba8cc6e7ffca1ff277267 /src/txdb.cpp
parent03675b2ba37d4c6216be4ffe6fbf5352f3e93c69 (diff)
log: Print error message when coindb is in inconsistent state
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r--src/txdb.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index e5b5e0b8a1..538c4d8f07 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -123,6 +123,9 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock, boo
// We may be in the middle of replaying.
std::vector<uint256> old_heads = GetHeadBlocks();
if (old_heads.size() == 2) {
+ if (old_heads[0] != hashBlock) {
+ LogPrintLevel(BCLog::COINDB, BCLog::Level::Error, "The coins database detected an inconsistent state, likely due to a previous crash or shutdown. You will need to restart bitcoind with the -reindex-chainstate or -reindex configuration option.\n");
+ }
assert(old_heads[0] == hashBlock);
old_tip = old_heads[1];
}