From d1847cf5b5af232ad180f5d302361b72334952b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Tue, 22 Jul 2025 12:23:07 -0700 Subject: [PATCH] refactor: inline constant return value of `TxIndex::DB::WriteTxs` --- src/index/txindex.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 16038a3a2b6..9554faf1e3a 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -28,7 +28,7 @@ public: bool ReadTxPos(const Txid& txid, CDiskTxPos& pos) const; /// Write a batch of transaction positions to the DB. - [[nodiscard]] bool WriteTxs(const std::vector>& v_pos); + void WriteTxs(const std::vector>& v_pos); }; TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) : @@ -40,14 +40,13 @@ bool TxIndex::DB::ReadTxPos(const Txid& txid, CDiskTxPos& pos) const return Read(std::make_pair(DB_TXINDEX, txid.ToUint256()), pos); } -bool TxIndex::DB::WriteTxs(const std::vector>& v_pos) +void TxIndex::DB::WriteTxs(const std::vector>& v_pos) { CDBBatch batch(*this); for (const auto& [txid, pos] : v_pos) { batch.Write(std::make_pair(DB_TXINDEX, txid.ToUint256()), pos); } WriteBatch(batch); - return true; } TxIndex::TxIndex(std::unique_ptr chain, size_t n_cache_size, bool f_memory, bool f_wipe) @@ -69,7 +68,8 @@ bool TxIndex::CustomAppend(const interfaces::BlockInfo& block) vPos.emplace_back(tx->GetHash(), pos); pos.nTxOffset += ::GetSerializeSize(TX_WITH_WITNESS(*tx)); } - return m_db->WriteTxs(vPos); + m_db->WriteTxs(vPos); + return true; } BaseIndex::DB& TxIndex::GetDB() const { return *m_db; }