diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 29b624cb12..338452c23f 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -818,13 +818,13 @@ void BlockManager::UnlinkPrunedFiles(const std::set& setFilesToPrune) const AutoFile BlockManager::OpenBlockFile(const FlatFilePos& pos, bool fReadOnly) const { - return AutoFile{m_block_file_seq.Open(pos, fReadOnly)}; + return AutoFile{m_block_file_seq.Open(pos, fReadOnly), m_xor_key}; } /** Open an undo file (rev?????.dat) */ AutoFile BlockManager::OpenUndoFile(const FlatFilePos& pos, bool fReadOnly) const { - return AutoFile{m_undo_file_seq.Open(pos, fReadOnly)}; + return AutoFile{m_undo_file_seq.Open(pos, fReadOnly), m_xor_key}; } fs::path BlockManager::GetBlockPosFilename(const FlatFilePos& pos) const @@ -1144,6 +1144,14 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight) return blockPos; } +BlockManager::BlockManager(const util::SignalInterrupt& interrupt, Options opts) + : m_prune_mode{opts.prune_target > 0}, + m_xor_key{}, + m_opts{std::move(opts)}, + m_block_file_seq{FlatFileSeq{m_opts.blocks_dir, "blk", m_opts.fast_prune ? 0x4000 /* 16kB */ : BLOCKFILE_CHUNK_SIZE}}, + m_undo_file_seq{FlatFileSeq{m_opts.blocks_dir, "rev", UNDOFILE_CHUNK_SIZE}}, + m_interrupt{interrupt} {} + class ImportingNow { std::atomic& m_importing; diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h index 8c6190cd02..821bbf5109 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.h @@ -240,6 +240,8 @@ private: const bool m_prune_mode; + const std::vector m_xor_key; + /** Dirty block index entries. */ std::set m_dirty_blockindex; @@ -264,12 +266,7 @@ private: public: using Options = kernel::BlockManagerOpts; - explicit BlockManager(const util::SignalInterrupt& interrupt, Options opts) - : m_prune_mode{opts.prune_target > 0}, - m_opts{std::move(opts)}, - m_block_file_seq{FlatFileSeq{m_opts.blocks_dir, "blk", m_opts.fast_prune ? 0x4000 /* 16kB */ : BLOCKFILE_CHUNK_SIZE}}, - m_undo_file_seq{FlatFileSeq{m_opts.blocks_dir, "rev", UNDOFILE_CHUNK_SIZE}}, - m_interrupt{interrupt} {} + explicit BlockManager(const util::SignalInterrupt& interrupt, Options opts); const util::SignalInterrupt& m_interrupt; std::atomic m_importing{false};