Declare `CBlockTreeDB::Read*` methods as `const` when they are trivially so.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
089acd75f7
commit
fb66589022
16
src/txdb.cpp
16
src/txdb.cpp
|
@ -318,7 +318,7 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins,
|
|||
CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) {
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) {
|
||||
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) const {
|
||||
return Read(make_pair(DB_BLOCK_FILES, nFile), info);
|
||||
}
|
||||
|
||||
|
@ -329,12 +329,12 @@ bool CBlockTreeDB::WriteReindexing(bool fReindexing) {
|
|||
return Erase(DB_REINDEX_FLAG);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadReindexing(bool &fReindexing) {
|
||||
bool CBlockTreeDB::ReadReindexing(bool &fReindexing) const {
|
||||
fReindexing = Exists(DB_REINDEX_FLAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
|
||||
bool CBlockTreeDB::ReadLastBlockFile(int &nFile) const {
|
||||
return Read(DB_LAST_BLOCK, nFile);
|
||||
}
|
||||
|
||||
|
@ -421,11 +421,11 @@ bool CBlockTreeDB::EraseBatchSync(const std::vector<const CBlockIndex*>& blockin
|
|||
return WriteBatch(batch, true);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadDiskBlockIndex(const uint256 &blockhash, CDiskBlockIndex &dbindex) {
|
||||
bool CBlockTreeDB::ReadDiskBlockIndex(const uint256 &blockhash, CDiskBlockIndex &dbindex) const {
|
||||
return Read(make_pair(DB_BLOCK_INDEX, blockhash), dbindex);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) {
|
||||
bool CBlockTreeDB::ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) const {
|
||||
return Read(make_pair(DB_TXINDEX, txid), pos);
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ bool CBlockTreeDB::ReadAddressIndex(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value) {
|
||||
bool CBlockTreeDB::ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value) const {
|
||||
return Read(make_pair(DB_SPENTINDEX, key), value);
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ bool CBlockTreeDB::WriteTimestampBlockIndex(const CTimestampBlockIndexKey &block
|
|||
return WriteBatch(batch);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadTimestampBlockIndex(const uint256 &hash, unsigned int <imestamp)
|
||||
bool CBlockTreeDB::ReadTimestampBlockIndex(const uint256 &hash, unsigned int <imestamp) const
|
||||
{
|
||||
CTimestampBlockIndexValue(lts);
|
||||
if (!Read(std::make_pair(DB_BLOCKHASHINDEX, hash), lts))
|
||||
|
@ -585,7 +585,7 @@ bool CBlockTreeDB::WriteFlag(const std::string &name, bool fValue) {
|
|||
return Write(std::make_pair(DB_FLAG, name), fValue ? '1' : '0');
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
|
||||
bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) const {
|
||||
char ch;
|
||||
if (!Read(std::make_pair(DB_FLAG, name), ch))
|
||||
return false;
|
||||
|
|
16
src/txdb.h
16
src/txdb.h
|
@ -119,12 +119,12 @@ private:
|
|||
public:
|
||||
bool WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<CBlockIndex*>& blockinfo);
|
||||
bool EraseBatchSync(const std::vector<const CBlockIndex*>& blockinfo);
|
||||
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &info);
|
||||
bool ReadLastBlockFile(int &nFile);
|
||||
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &info) const;
|
||||
bool ReadLastBlockFile(int &nFile) const;
|
||||
bool WriteReindexing(bool fReindexing);
|
||||
bool ReadReindexing(bool &fReindexing);
|
||||
bool ReadDiskBlockIndex(const uint256 &blockhash, CDiskBlockIndex &dbindex);
|
||||
bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos);
|
||||
bool ReadReindexing(bool &fReindexing) const;
|
||||
bool ReadDiskBlockIndex(const uint256 &blockhash, CDiskBlockIndex &dbindex) const;
|
||||
bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) const;
|
||||
bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &vect);
|
||||
|
||||
// START insightexplorer
|
||||
|
@ -133,18 +133,18 @@ public:
|
|||
bool WriteAddressIndex(const std::vector<CAddressIndexDbEntry> &vect);
|
||||
bool EraseAddressIndex(const std::vector<CAddressIndexDbEntry> &vect);
|
||||
bool ReadAddressIndex(uint160 addressHash, int type, std::vector<CAddressIndexDbEntry> &addressIndex, int start = 0, int end = 0);
|
||||
bool ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value);
|
||||
bool ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value) const;
|
||||
bool UpdateSpentIndex(const std::vector<CSpentIndexDbEntry> &vect);
|
||||
bool WriteTimestampIndex(const CTimestampIndexKey ×tampIndex);
|
||||
bool ReadTimestampIndex(unsigned int high, unsigned int low,
|
||||
const bool fActiveOnly, std::vector<std::pair<uint256, unsigned int> > &vect);
|
||||
bool WriteTimestampBlockIndex(const CTimestampBlockIndexKey &blockhashIndex,
|
||||
const CTimestampBlockIndexValue &logicalts);
|
||||
bool ReadTimestampBlockIndex(const uint256 &hash, unsigned int &logicalTS);
|
||||
bool ReadTimestampBlockIndex(const uint256 &hash, unsigned int &logicalTS) const;
|
||||
// END insightexplorer
|
||||
|
||||
bool WriteFlag(const std::string &name, bool fValue);
|
||||
bool ReadFlag(const std::string &name, bool &fValue);
|
||||
bool ReadFlag(const std::string &name, bool &fValue) const;
|
||||
bool LoadBlockIndexGuts(
|
||||
std::function<CBlockIndex*(const uint256&)> insertBlockIndex,
|
||||
const CChainParams& chainParams);
|
||||
|
|
Loading…
Reference in New Issue