Fixup style of moved code

Can be reviewed with --word-diff-regex=.
pull/28195/head
MarcoFalke 1 year ago
parent fa65111b99
commit faf63039cc
No known key found for this signature in database

@ -38,45 +38,54 @@ static constexpr uint8_t DB_LAST_BLOCK{'l'};
// CBlockTreeDB::DB_TXINDEX{'t'}
// CBlockTreeDB::ReadFlag("txindex")
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) {
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo& info)
{
return Read(std::make_pair(DB_BLOCK_FILES, nFile), info);
}
bool CBlockTreeDB::WriteReindexing(bool fReindexing) {
if (fReindexing)
bool CBlockTreeDB::WriteReindexing(bool fReindexing)
{
if (fReindexing) {
return Write(DB_REINDEX_FLAG, uint8_t{'1'});
else
} else {
return Erase(DB_REINDEX_FLAG);
}
}
void CBlockTreeDB::ReadReindexing(bool &fReindexing) {
void CBlockTreeDB::ReadReindexing(bool& fReindexing)
{
fReindexing = Exists(DB_REINDEX_FLAG);
}
bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
bool CBlockTreeDB::ReadLastBlockFile(int& nFile)
{
return Read(DB_LAST_BLOCK, nFile);
}
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*>>& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo)
{
CDBBatch batch(*this);
for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
batch.Write(std::make_pair(DB_BLOCK_FILES, it->first), *it->second);
for (const auto& [file, info] : fileInfo) {
batch.Write(std::make_pair(DB_BLOCK_FILES, file), *info);
}
batch.Write(DB_LAST_BLOCK, nLastFile);
for (std::vector<const CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
batch.Write(std::make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
for (const CBlockIndex* bi : blockinfo) {
batch.Write(std::make_pair(DB_BLOCK_INDEX, bi->GetBlockHash()), CDiskBlockIndex{bi});
}
return WriteBatch(batch, true);
}
bool CBlockTreeDB::WriteFlag(const std::string &name, bool fValue) {
bool CBlockTreeDB::WriteFlag(const std::string& name, bool fValue)
{
return Write(std::make_pair(DB_FLAG, name), fValue ? uint8_t{'1'} : uint8_t{'0'});
}
bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
bool CBlockTreeDB::ReadFlag(const std::string& name, bool& fValue)
{
uint8_t ch;
if (!Read(std::make_pair(DB_FLAG, name), ch))
if (!Read(std::make_pair(DB_FLAG, name), ch)) {
return false;
}
fValue = ch == uint8_t{'1'};
return true;
}

Loading…
Cancel
Save