Skip to content

Commit d1847cf

Browse files
committed
refactor: inline constant return value of TxIndex::DB::WriteTxs
1 parent 50b63a5 commit d1847cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index/txindex.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TxIndex::DB : public BaseIndex::DB
2828
bool ReadTxPos(const Txid& txid, CDiskTxPos& pos) const;
2929

3030
/// Write a batch of transaction positions to the DB.
31-
[[nodiscard]] bool WriteTxs(const std::vector<std::pair<Txid, CDiskTxPos>>& v_pos);
31+
void WriteTxs(const std::vector<std::pair<Txid, CDiskTxPos>>& v_pos);
3232
};
3333

3434
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
4040
return Read(std::make_pair(DB_TXINDEX, txid.ToUint256()), pos);
4141
}
4242

43-
bool TxIndex::DB::WriteTxs(const std::vector<std::pair<Txid, CDiskTxPos>>& v_pos)
43+
void TxIndex::DB::WriteTxs(const std::vector<std::pair<Txid, CDiskTxPos>>& v_pos)
4444
{
4545
CDBBatch batch(*this);
4646
for (const auto& [txid, pos] : v_pos) {
4747
batch.Write(std::make_pair(DB_TXINDEX, txid.ToUint256()), pos);
4848
}
4949
WriteBatch(batch);
50-
return true;
5150
}
5251

5352
TxIndex::TxIndex(std::unique_ptr<interfaces::Chain> chain, size_t n_cache_size, bool f_memory, bool f_wipe)
@@ -69,7 +68,8 @@ bool TxIndex::CustomAppend(const interfaces::BlockInfo& block)
6968
vPos.emplace_back(tx->GetHash(), pos);
7069
pos.nTxOffset += ::GetSerializeSize(TX_WITH_WITNESS(*tx));
7170
}
72-
return m_db->WriteTxs(vPos);
71+
m_db->WriteTxs(vPos);
72+
return true;
7373
}
7474

7575
BaseIndex::DB& TxIndex::GetDB() const { return *m_db; }

0 commit comments

Comments
 (0)