From 38ed58b8503f2809e555036f4e98ff9b40a950c8 Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Sun, 23 Jan 2022 01:55:14 +0100 Subject: [PATCH 1/2] index: remove txindex references from base index --- src/index/base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index/base.h b/src/index/base.h index 66149686f0a..c4a8215bc4c 100644 --- a/src/index/base.h +++ b/src/index/base.h @@ -40,10 +40,10 @@ protected: DB(const fs::path& path, size_t n_cache_size, bool f_memory = false, bool f_wipe = false, bool f_obfuscate = false); - /// Read block locator of the chain that the txindex is in sync with. + /// Read block locator of the chain that the index is in sync with. bool ReadBestBlock(CBlockLocator& locator) const; - /// Write block locator of the chain that the txindex is in sync with. + /// Write block locator of the chain that the index is in sync with. void WriteBestBlock(CDBBatch& batch, const CBlockLocator& locator); }; From 820c03aff5295fff68a4577aa51667198036e372 Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Sun, 23 Jan 2022 15:53:07 +0100 Subject: [PATCH 2/2] index: check muhash is in sync on coinstatsindex launch --- src/index/coinstatsindex.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index 7d4860b20bf..a1c8a5937cd 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -363,6 +363,14 @@ bool CoinStatsIndex::Init() return error("%s: Cannot read current %s state; index may be corrupted", __func__, GetName()); } + + uint256 out; + m_muhash.Finalize(out); + if (entry.muhash != out) { + return error("%s: Cannot read current %s state; index may be corrupted", + __func__, GetName()); + } + m_transaction_output_count = entry.transaction_output_count; m_bogo_size = entry.bogo_size; m_total_amount = entry.total_amount;