mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
Return XOR AutoFile from BlockManager::Open*File()
This is a refactor, because the XOR key is empty.
This commit is contained in:
parent
1e8d689e01
commit
fa7f7ac040
2 changed files with 13 additions and 8 deletions
|
@ -818,13 +818,13 @@ void BlockManager::UnlinkPrunedFiles(const std::set<int>& setFilesToPrune) const
|
||||||
|
|
||||||
AutoFile BlockManager::OpenBlockFile(const FlatFilePos& pos, bool fReadOnly) 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) */
|
/** Open an undo file (rev?????.dat) */
|
||||||
AutoFile BlockManager::OpenUndoFile(const FlatFilePos& pos, bool fReadOnly) const
|
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
|
fs::path BlockManager::GetBlockPosFilename(const FlatFilePos& pos) const
|
||||||
|
@ -1144,6 +1144,14 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight)
|
||||||
return blockPos;
|
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
|
class ImportingNow
|
||||||
{
|
{
|
||||||
std::atomic<bool>& m_importing;
|
std::atomic<bool>& m_importing;
|
||||||
|
|
|
@ -240,6 +240,8 @@ private:
|
||||||
|
|
||||||
const bool m_prune_mode;
|
const bool m_prune_mode;
|
||||||
|
|
||||||
|
const std::vector<std::byte> m_xor_key;
|
||||||
|
|
||||||
/** Dirty block index entries. */
|
/** Dirty block index entries. */
|
||||||
std::set<CBlockIndex*> m_dirty_blockindex;
|
std::set<CBlockIndex*> m_dirty_blockindex;
|
||||||
|
|
||||||
|
@ -264,12 +266,7 @@ private:
|
||||||
public:
|
public:
|
||||||
using Options = kernel::BlockManagerOpts;
|
using Options = kernel::BlockManagerOpts;
|
||||||
|
|
||||||
explicit BlockManager(const util::SignalInterrupt& interrupt, Options opts)
|
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} {}
|
|
||||||
|
|
||||||
const util::SignalInterrupt& m_interrupt;
|
const util::SignalInterrupt& m_interrupt;
|
||||||
std::atomic<bool> m_importing{false};
|
std::atomic<bool> m_importing{false};
|
||||||
|
|
Loading…
Add table
Reference in a new issue