mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 12:55:02 +02:00
move-only: Move CBlockTreeDB to node/blockstorage
The block index (CBlockTreeDB) is required to write and read blocks, so move it to blockstorage. This allows to drop the txdb.h include from `node/blockstorage.h`. Can be reviewed with: --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
This commit is contained in:
@@ -7,17 +7,25 @@
|
||||
|
||||
#include <attributes.h>
|
||||
#include <chain.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <kernel/blockmanager_opts.h>
|
||||
#include <kernel/chainparams.h>
|
||||
#include <kernel/cs_main.h>
|
||||
#include <protocol.h>
|
||||
#include <sync.h>
|
||||
#include <txdb.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/hasher.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class BlockValidationState;
|
||||
@@ -36,7 +44,26 @@ namespace util {
|
||||
class SignalInterrupt;
|
||||
} // namespace util
|
||||
|
||||
namespace kernel {
|
||||
/** Access to the block database (blocks/index/) */
|
||||
class CBlockTreeDB : public CDBWrapper
|
||||
{
|
||||
public:
|
||||
using CDBWrapper::CDBWrapper;
|
||||
bool WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*>>& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo);
|
||||
bool ReadBlockFileInfo(int nFile, CBlockFileInfo& info);
|
||||
bool ReadLastBlockFile(int& nFile);
|
||||
bool WriteReindexing(bool fReindexing);
|
||||
void ReadReindexing(bool& fReindexing);
|
||||
bool WriteFlag(const std::string& name, bool fValue);
|
||||
bool ReadFlag(const std::string& name, bool& fValue);
|
||||
bool LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex, const util::SignalInterrupt& interrupt)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
};
|
||||
} // namespace kernel
|
||||
|
||||
namespace node {
|
||||
using kernel::CBlockTreeDB;
|
||||
|
||||
/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */
|
||||
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
|
||||
|
||||
Reference in New Issue
Block a user