aboutsummaryrefslogtreecommitdiff
path: root/src/node/blockstorage.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-09-05 11:22:10 +0100
committerfanquake <fanquake@gmail.com>2023-09-05 11:37:35 +0100
commitecab855838fa4de4c6d8c11e69037477d6047790 (patch)
tree4034b5ca654f05554bfc770f2912394c1aab57f1 /src/node/blockstorage.h
parent8c7e7354561d73e24b03ab40780010508fad1401 (diff)
parentfae405556d56f6f13ce57f69a06b9ec1e825422b (diff)
downloadbitcoin-ecab855838fa4de4c6d8c11e69037477d6047790.tar.xz
Merge bitcoin/bitcoin#28195: blockstorage: Drop legacy -txindex check
fae405556d56f6f13ce57f69a06b9ec1e825422b scripted-diff: Rename CBlockTreeDB -> BlockTreeDB (MarcoFalke) faf63039cce40f5cf8dea5a1d24945773c3433a1 Fixup style of moved code (MarcoFalke) fa65111b99627289fd47dcfaa5197e0f09b8a50e move-only: Move CBlockTreeDB to node/blockstorage (MarcoFalke) fa8685597e7302fc136f21b6dd3a4b187fa8e251 index: Drop legacy -txindex check (MarcoFalke) fa69148a0a26c5054dbccdceeac8e117bf449275 scripted-diff: Use blocks_path where possible (MarcoFalke) Pull request description: The only reason for the check was to print a warning about an increase in storage use. Now that 22.x is EOL and everyone should have migrated (or decided to not care about storage use), remove the check. Also, a move-only commit is included. (Rebased from https://github.com/bitcoin/bitcoin/pull/22242) ACKs for top commit: TheCharlatan: ACK fae405556d56f6f13ce57f69a06b9ec1e825422b, though I lack historical context to really judge the second commit fa8685597e7302fc136f21b6dd3a4b187fa8e251. stickies-v: ACK fae405556d56f6f13ce57f69a06b9ec1e825422b Tree-SHA512: 9da8f48767ae52d8e8e21c09a40c949cc0838794f1856cc5f58a91acd3f00a3bca818c8082242b3fdc9ca5badb09059570bb3870850d3807b75a8e23b5222da1
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);