aboutsummaryrefslogtreecommitdiff
path: root/src/node/blockstorage.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/blockstorage.h')
-rw-r--r--src/node/blockstorage.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h
index 0180124a79..c79fd2c6a1 100644
--- a/src/node/blockstorage.h
+++ b/src/node/blockstorage.h
@@ -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 BlockTreeDB : 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::BlockTreeDB;
/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
@@ -185,7 +212,7 @@ public:
*/
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 LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);