mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-25 08:01:02 +02:00
Index: Improve logging in coinstatsindex
More accurate logging of a warning should make clear if the recovery condition was hit while catching the results of the previous block.
This commit is contained in:
parent
d4356d4e48
commit
5b3d4e724f
@ -122,9 +122,12 @@ bool CoinStatsIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex)
|
||||
|
||||
uint256 expected_block_hash{pindex->pprev->GetBlockHash()};
|
||||
if (read_out.first != expected_block_hash) {
|
||||
LogPrintf("WARNING: previous block header belongs to unexpected block %s; expected %s\n",
|
||||
read_out.first.ToString(), expected_block_hash.ToString());
|
||||
|
||||
if (!m_db->Read(DBHashKey(expected_block_hash), read_out)) {
|
||||
return error("%s: previous block header belongs to unexpected block %s; expected %s",
|
||||
__func__, read_out.first.ToString(), expected_block_hash.ToString());
|
||||
return error("%s: previous block header not found; expected %s",
|
||||
__func__, expected_block_hash.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,9 +395,12 @@ bool CoinStatsIndex::ReverseBlock(const CBlock& block, const CBlockIndex* pindex
|
||||
|
||||
uint256 expected_block_hash{pindex->pprev->GetBlockHash()};
|
||||
if (read_out.first != expected_block_hash) {
|
||||
LogPrintf("WARNING: previous block header belongs to unexpected block %s; expected %s\n",
|
||||
read_out.first.ToString(), expected_block_hash.ToString());
|
||||
|
||||
if (!m_db->Read(DBHashKey(expected_block_hash), read_out)) {
|
||||
return error("%s: previous block header belongs to unexpected block %s; expected %s",
|
||||
__func__, read_out.first.ToString(), expected_block_hash.ToString());
|
||||
return error("%s: previous block header not found; expected %s",
|
||||
__func__, expected_block_hash.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user