From 54dc34ec2279378c78fa2d9155668e39e20decda Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Mon, 1 Sep 2025 23:26:44 +0200 Subject: [PATCH] index: Remove unused coinstatsindex recovery code The coinstatsindex currently looks for block data at a hash key if the prev block in CustomAppend is different than expected. This is not needed since base index should always prevent us ending up in this scenario since it should rewind the index before calling CustomAppend in this case. But even if we run into this and our belt-and-suspenders code is getting hit, the index could not recover properly from the hash key index data so it can be removed without any real impact. --- src/index/coinstatsindex.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index 24b1837bb09..3d092254894 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -139,15 +139,9 @@ bool CoinStatsIndex::CustomAppend(const interfaces::BlockInfo& block) if (block.height > 0) { uint256 expected_block_hash{*Assert(block.prev_hash)}; if (m_current_block_hash != expected_block_hash) { - LogWarning("previous block header belongs to unexpected block %s; expected %s", + LogError("previous block header belongs to unexpected block %s; expected %s", m_current_block_hash.ToString(), expected_block_hash.ToString()); - - std::pair read_out; - if (!m_db->Read(DBHashKey(expected_block_hash), read_out)) { - LogError("previous block header not found; expected %s", - expected_block_hash.ToString()); - return false; - } + return false; } // Add the new utxos created from the block