Skip to content

Commit df60de7

Browse files
committed
log: Print error message when coindb is in inconsistent state
1 parent 03675b2 commit df60de7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/txdb.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock, boo
123123
// We may be in the middle of replaying.
124124
std::vector<uint256> old_heads = GetHeadBlocks();
125125
if (old_heads.size() == 2) {
126+
if (old_heads[0] != hashBlock) {
127+
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");
128+
}
126129
assert(old_heads[0] == hashBlock);
127130
old_tip = old_heads[1];
128131
}

0 commit comments

Comments
 (0)