mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Remove unused MessageStartChars parameters from BlockManager methods
This commit is contained in:
parent
44b05bf3fe
commit
fa69e3a95c
3 changed files with 13 additions and 13 deletions
|
@ -2212,7 +2212,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
|
||||||
// Fast-path: in this case it is possible to serve the block directly from disk,
|
// Fast-path: in this case it is possible to serve the block directly from disk,
|
||||||
// as the network format matches the format on disk
|
// as the network format matches the format on disk
|
||||||
std::vector<uint8_t> block_data;
|
std::vector<uint8_t> block_data;
|
||||||
if (!m_chainman.m_blockman.ReadRawBlockFromDisk(block_data, pindex->GetBlockPos(), m_chainparams.MessageStart())) {
|
if (!m_chainman.m_blockman.ReadRawBlockFromDisk(block_data, pindex->GetBlockPos())) {
|
||||||
assert(!"cannot load block from disk");
|
assert(!"cannot load block from disk");
|
||||||
}
|
}
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::BLOCK, Span{block_data}));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::BLOCK, Span{block_data}));
|
||||||
|
|
|
@ -476,7 +476,7 @@ CBlockFileInfo* BlockManager::GetBlockFileInfo(size_t n)
|
||||||
return &m_blockfile_info.at(n);
|
return &m_blockfile_info.at(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart) const
|
bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock) const
|
||||||
{
|
{
|
||||||
// Open history file to append
|
// Open history file to append
|
||||||
AutoFile fileout{OpenUndoFile(pos)};
|
AutoFile fileout{OpenUndoFile(pos)};
|
||||||
|
@ -486,7 +486,7 @@ bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos
|
||||||
|
|
||||||
// Write index header
|
// Write index header
|
||||||
unsigned int nSize = GetSerializeSize(blockundo, CLIENT_VERSION);
|
unsigned int nSize = GetSerializeSize(blockundo, CLIENT_VERSION);
|
||||||
fileout << messageStart << nSize;
|
fileout << GetParams().MessageStart() << nSize;
|
||||||
|
|
||||||
// Write undo data
|
// Write undo data
|
||||||
long fileOutPos = ftell(fileout.Get());
|
long fileOutPos = ftell(fileout.Get());
|
||||||
|
@ -707,7 +707,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const CMessageHeader::MessageStartChars& messageStart) const
|
bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos) const
|
||||||
{
|
{
|
||||||
// Open history file to append
|
// Open history file to append
|
||||||
CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION);
|
CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION);
|
||||||
|
@ -717,7 +717,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const
|
||||||
|
|
||||||
// Write index header
|
// Write index header
|
||||||
unsigned int nSize = GetSerializeSize(block, fileout.GetVersion());
|
unsigned int nSize = GetSerializeSize(block, fileout.GetVersion());
|
||||||
fileout << messageStart << nSize;
|
fileout << GetParams().MessageStart() << nSize;
|
||||||
|
|
||||||
// Write block
|
// Write block
|
||||||
long fileOutPos = ftell(fileout.Get());
|
long fileOutPos = ftell(fileout.Get());
|
||||||
|
@ -739,7 +739,7 @@ bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValid
|
||||||
if (!FindUndoPos(state, block.nFile, _pos, ::GetSerializeSize(blockundo, CLIENT_VERSION) + 40)) {
|
if (!FindUndoPos(state, block.nFile, _pos, ::GetSerializeSize(blockundo, CLIENT_VERSION) + 40)) {
|
||||||
return error("ConnectBlock(): FindUndoPos failed");
|
return error("ConnectBlock(): FindUndoPos failed");
|
||||||
}
|
}
|
||||||
if (!UndoWriteToDisk(blockundo, _pos, block.pprev->GetBlockHash(), GetParams().MessageStart())) {
|
if (!UndoWriteToDisk(blockundo, _pos, block.pprev->GetBlockHash())) {
|
||||||
return FatalError(m_opts.notifications, state, "Failed to write undo data");
|
return FatalError(m_opts.notifications, state, "Failed to write undo data");
|
||||||
}
|
}
|
||||||
// rev files are written in block height order, whereas blk files are written as blocks come in (often out of order)
|
// rev files are written in block height order, whereas blk files are written as blocks come in (often out of order)
|
||||||
|
@ -804,7 +804,7 @@ bool BlockManager::ReadBlockFromDisk(CBlock& block, const CBlockIndex& index) co
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start) const
|
bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos) const
|
||||||
{
|
{
|
||||||
FlatFilePos hpos = pos;
|
FlatFilePos hpos = pos;
|
||||||
hpos.nPos -= 8; // Seek back 8 bytes for meta header
|
hpos.nPos -= 8; // Seek back 8 bytes for meta header
|
||||||
|
@ -819,10 +819,10 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
|
||||||
|
|
||||||
filein >> blk_start >> blk_size;
|
filein >> blk_start >> blk_size;
|
||||||
|
|
||||||
if (memcmp(blk_start, message_start, CMessageHeader::MESSAGE_START_SIZE)) {
|
if (memcmp(blk_start, GetParams().MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) {
|
||||||
return error("%s: Block magic mismatch for %s: %s versus expected %s", __func__, pos.ToString(),
|
return error("%s: Block magic mismatch for %s: %s versus expected %s", __func__, pos.ToString(),
|
||||||
HexStr(blk_start),
|
HexStr(blk_start),
|
||||||
HexStr(message_start));
|
HexStr(GetParams().MessageStart()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blk_size > MAX_SIZE) {
|
if (blk_size > MAX_SIZE) {
|
||||||
|
@ -857,7 +857,7 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
|
||||||
return FlatFilePos();
|
return FlatFilePos();
|
||||||
}
|
}
|
||||||
if (!position_known) {
|
if (!position_known) {
|
||||||
if (!WriteBlockToDisk(block, blockPos, GetParams().MessageStart())) {
|
if (!WriteBlockToDisk(block, blockPos)) {
|
||||||
m_opts.notifications.fatalError("Failed to write block");
|
m_opts.notifications.fatalError("Failed to write block");
|
||||||
return FlatFilePos();
|
return FlatFilePos();
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,8 @@ private:
|
||||||
|
|
||||||
FILE* OpenUndoFile(const FlatFilePos& pos, bool fReadOnly = false) const;
|
FILE* OpenUndoFile(const FlatFilePos& pos, bool fReadOnly = false) const;
|
||||||
|
|
||||||
bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const CMessageHeader::MessageStartChars& messageStart) const;
|
bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos) const;
|
||||||
bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart) const;
|
bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock) const;
|
||||||
|
|
||||||
/* Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain */
|
/* Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain */
|
||||||
void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight, int chain_tip_height);
|
void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight, int chain_tip_height);
|
||||||
|
@ -252,7 +252,7 @@ public:
|
||||||
/** Functions for disk access for blocks */
|
/** Functions for disk access for blocks */
|
||||||
bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos) const;
|
bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos) const;
|
||||||
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex& index) const;
|
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex& index) const;
|
||||||
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start) const;
|
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos) const;
|
||||||
|
|
||||||
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex& index) const;
|
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex& index) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue