0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-04 13:55:23 -05:00

scripted-diff: Rename CBlockTreeDB -> BlockTreeDB

-BEGIN VERIFY SCRIPT-
 sed -i 's|CBlockTreeDB|BlockTreeDB|g' $( git grep -l CBlockTreeDB )
-END VERIFY SCRIPT-
This commit is contained in:
MarcoFalke 2023-08-02 07:50:22 +02:00
parent faf63039cc
commit fae405556d
No known key found for this signature in database
4 changed files with 18 additions and 18 deletions

View file

@ -34,16 +34,16 @@ static constexpr uint8_t DB_FLAG{'F'};
static constexpr uint8_t DB_REINDEX_FLAG{'R'}; static constexpr uint8_t DB_REINDEX_FLAG{'R'};
static constexpr uint8_t DB_LAST_BLOCK{'l'}; static constexpr uint8_t DB_LAST_BLOCK{'l'};
// Keys used in previous version that might still be found in the DB: // Keys used in previous version that might still be found in the DB:
// CBlockTreeDB::DB_TXINDEX_BLOCK{'T'}; // BlockTreeDB::DB_TXINDEX_BLOCK{'T'};
// CBlockTreeDB::DB_TXINDEX{'t'} // BlockTreeDB::DB_TXINDEX{'t'}
// CBlockTreeDB::ReadFlag("txindex") // BlockTreeDB::ReadFlag("txindex")
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo& info) bool BlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo& info)
{ {
return Read(std::make_pair(DB_BLOCK_FILES, nFile), info); return Read(std::make_pair(DB_BLOCK_FILES, nFile), info);
} }
bool CBlockTreeDB::WriteReindexing(bool fReindexing) bool BlockTreeDB::WriteReindexing(bool fReindexing)
{ {
if (fReindexing) { if (fReindexing) {
return Write(DB_REINDEX_FLAG, uint8_t{'1'}); return Write(DB_REINDEX_FLAG, uint8_t{'1'});
@ -52,17 +52,17 @@ bool CBlockTreeDB::WriteReindexing(bool fReindexing)
} }
} }
void CBlockTreeDB::ReadReindexing(bool& fReindexing) void BlockTreeDB::ReadReindexing(bool& fReindexing)
{ {
fReindexing = Exists(DB_REINDEX_FLAG); fReindexing = Exists(DB_REINDEX_FLAG);
} }
bool CBlockTreeDB::ReadLastBlockFile(int& nFile) bool BlockTreeDB::ReadLastBlockFile(int& nFile)
{ {
return Read(DB_LAST_BLOCK, 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 BlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*>>& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo)
{ {
CDBBatch batch(*this); CDBBatch batch(*this);
for (const auto& [file, info] : fileInfo) { for (const auto& [file, info] : fileInfo) {
@ -75,12 +75,12 @@ bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockF
return WriteBatch(batch, true); return WriteBatch(batch, true);
} }
bool CBlockTreeDB::WriteFlag(const std::string& name, bool fValue) bool BlockTreeDB::WriteFlag(const std::string& name, bool fValue)
{ {
return Write(std::make_pair(DB_FLAG, name), fValue ? uint8_t{'1'} : uint8_t{'0'}); 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 BlockTreeDB::ReadFlag(const std::string& name, bool& fValue)
{ {
uint8_t ch; uint8_t ch;
if (!Read(std::make_pair(DB_FLAG, name), ch)) { if (!Read(std::make_pair(DB_FLAG, name), ch)) {
@ -90,7 +90,7 @@ bool CBlockTreeDB::ReadFlag(const std::string& name, bool& fValue)
return true; return true;
} }
bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex, const util::SignalInterrupt& interrupt) bool BlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex, const util::SignalInterrupt& interrupt)
{ {
AssertLockHeld(::cs_main); AssertLockHeld(::cs_main);
std::unique_ptr<CDBIterator> pcursor(NewIterator()); std::unique_ptr<CDBIterator> pcursor(NewIterator());

View file

@ -46,7 +46,7 @@ class SignalInterrupt;
namespace kernel { namespace kernel {
/** Access to the block database (blocks/index/) */ /** Access to the block database (blocks/index/) */
class CBlockTreeDB : public CDBWrapper class BlockTreeDB : public CDBWrapper
{ {
public: public:
using CDBWrapper::CDBWrapper; using CDBWrapper::CDBWrapper;
@ -63,7 +63,7 @@ public:
} // namespace kernel } // namespace kernel
namespace node { namespace node {
using kernel::CBlockTreeDB; using kernel::BlockTreeDB;
/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */ /** The pre-allocation chunk size for blk?????.dat files (since 0.8) */
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
@ -212,7 +212,7 @@ public:
*/ */
std::multimap<CBlockIndex*, CBlockIndex*> m_blocks_unlinked; std::multimap<CBlockIndex*, CBlockIndex*> m_blocks_unlinked;
std::unique_ptr<CBlockTreeDB> m_block_tree_db GUARDED_BY(::cs_main); std::unique_ptr<BlockTreeDB> m_block_tree_db GUARDED_BY(::cs_main);
bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);

View file

@ -37,10 +37,10 @@ static ChainstateLoadResult CompleteChainstateInitialization(
const ChainstateLoadOptions& options) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) const ChainstateLoadOptions& options) EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
{ {
auto& pblocktree{chainman.m_blockman.m_block_tree_db}; auto& pblocktree{chainman.m_blockman.m_block_tree_db};
// new CBlockTreeDB tries to delete the existing file, which // new BlockTreeDB tries to delete the existing file, which
// fails if it's still open from the previous loop. Close it first: // fails if it's still open from the previous loop. Close it first:
pblocktree.reset(); pblocktree.reset();
pblocktree = std::make_unique<CBlockTreeDB>(DBParams{ pblocktree = std::make_unique<BlockTreeDB>(DBParams{
.path = chainman.m_options.datadir / "blocks" / "index", .path = chainman.m_options.datadir / "blocks" / "index",
.cache_bytes = static_cast<size_t>(cache_sizes.block_tree_db), .cache_bytes = static_cast<size_t>(cache_sizes.block_tree_db),
.memory_only = options.block_tree_db_in_memory, .memory_only = options.block_tree_db_in_memory,

View file

@ -63,7 +63,7 @@
#include <functional> #include <functional>
#include <stdexcept> #include <stdexcept>
using kernel::CBlockTreeDB; using kernel::BlockTreeDB;
using kernel::ValidationCacheSizes; using kernel::ValidationCacheSizes;
using node::ApplyArgsManOptions; using node::ApplyArgsManOptions;
using node::BlockAssembler; using node::BlockAssembler;
@ -182,7 +182,7 @@ ChainTestingSetup::ChainTestingSetup(const ChainType chainType, const std::vecto
.notifications = chainman_opts.notifications, .notifications = chainman_opts.notifications,
}; };
m_node.chainman = std::make_unique<ChainstateManager>(m_node.kernel->interrupt, chainman_opts, blockman_opts); m_node.chainman = std::make_unique<ChainstateManager>(m_node.kernel->interrupt, chainman_opts, blockman_opts);
m_node.chainman->m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(DBParams{ m_node.chainman->m_blockman.m_block_tree_db = std::make_unique<BlockTreeDB>(DBParams{
.path = m_args.GetDataDirNet() / "blocks" / "index", .path = m_args.GetDataDirNet() / "blocks" / "index",
.cache_bytes = static_cast<size_t>(m_cache_sizes.block_tree_db), .cache_bytes = static_cast<size_t>(m_cache_sizes.block_tree_db),
.memory_only = true}); .memory_only = true});