diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index 21132d93052..5fda798efd6 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -261,7 +261,7 @@ bool BlockFilterIndex::CustomAppend(const interfaces::BlockInfo& block) return true; } -static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, +[[nodiscard]] static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, const std::string& index_name, int start_height, int stop_height) { diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index d80885f8422..9dab8ca901b 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -235,7 +235,7 @@ bool CoinStatsIndex::CustomAppend(const interfaces::BlockInfo& block) return m_db->Write(DBHeightKey(block.height), value); } -static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, +[[nodiscard]] static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, const std::string& index_name, int start_height, int stop_height) { @@ -288,7 +288,9 @@ bool CoinStatsIndex::CustomRewind(const interfaces::BlockKey& current_tip, const __func__, iter_tip->GetBlockHash().ToString()); } - ReverseBlock(block, iter_tip); + if (!ReverseBlock(block, iter_tip)) { + return false; // failure cause logged internally + } iter_tip = iter_tip->GetAncestor(iter_tip->nHeight - 1); } while (new_tip_index != iter_tip); diff --git a/src/index/coinstatsindex.h b/src/index/coinstatsindex.h index 21ce4c47674..d6322bfa7cf 100644 --- a/src/index/coinstatsindex.h +++ b/src/index/coinstatsindex.h @@ -38,7 +38,7 @@ private: CAmount m_total_unspendables_scripts{0}; CAmount m_total_unspendables_unclaimed_rewards{0}; - bool ReverseBlock(const CBlock& block, const CBlockIndex* pindex); + [[nodiscard]] bool ReverseBlock(const CBlock& block, const CBlockIndex* pindex); bool AllowPrune() const override { return true; } diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 0d4de3a53e7..3c9ec84e242 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -27,7 +27,7 @@ public: bool ReadTxPos(const uint256& txid, CDiskTxPos& pos) const; /// Write a batch of transaction positions to the DB. - bool WriteTxs(const std::vector>& v_pos); + [[nodiscard]] bool WriteTxs(const std::vector>& v_pos); }; TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) :