index: add [nodiscard] attribute to functions writing to the db

This commit is contained in:
furszy
2023-09-08 10:04:14 -03:00
parent eef595560e
commit c0bf667912
4 changed files with 4 additions and 4 deletions

View File

@ -260,7 +260,7 @@ bool BlockFilterIndex::CustomAppend(const interfaces::BlockInfo& block)
return true; return true;
} }
static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, [[nodiscard]] static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch,
const std::string& index_name, const std::string& index_name,
int start_height, int stop_height) int start_height, int stop_height)
{ {

View File

@ -235,7 +235,7 @@ bool CoinStatsIndex::CustomAppend(const interfaces::BlockInfo& block)
return m_db->Write(DBHeightKey(block.height), value); 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, const std::string& index_name,
int start_height, int stop_height) int start_height, int stop_height)
{ {

View File

@ -38,7 +38,7 @@ private:
CAmount m_total_unspendables_scripts{0}; CAmount m_total_unspendables_scripts{0};
CAmount m_total_unspendables_unclaimed_rewards{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; } bool AllowPrune() const override { return true; }

View File

@ -26,7 +26,7 @@ public:
bool ReadTxPos(const uint256& txid, CDiskTxPos& pos) const; bool ReadTxPos(const uint256& txid, CDiskTxPos& pos) const;
/// Write a batch of transaction positions to the DB. /// Write a batch of transaction positions to the DB.
bool WriteTxs(const std::vector<std::pair<uint256, CDiskTxPos>>& v_pos); [[nodiscard]] bool WriteTxs(const std::vector<std::pair<uint256, CDiskTxPos>>& v_pos);
}; };
TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) : TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) :