@@ -476,7 +476,7 @@ CBlockFileInfo* BlockManager::GetBlockFileInfo(size_t n)
476
476
return &m_blockfile_info.at (n);
477
477
}
478
478
479
- bool BlockManager::UndoWriteToDisk (const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart ) const
479
+ bool BlockManager::UndoWriteToDisk (const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock) const
480
480
{
481
481
// Open history file to append
482
482
AutoFile fileout{OpenUndoFile (pos)};
@@ -486,7 +486,7 @@ bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos
486
486
487
487
// Write index header
488
488
unsigned int nSize = GetSerializeSize (blockundo, CLIENT_VERSION);
489
- fileout << messageStart << nSize;
489
+ fileout << GetParams (). MessageStart () << nSize;
490
490
491
491
// Write undo data
492
492
long fileOutPos = ftell (fileout.Get ());
@@ -708,7 +708,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
708
708
return true ;
709
709
}
710
710
711
- bool BlockManager::WriteBlockToDisk (const CBlock& block, FlatFilePos& pos, const CMessageHeader::MessageStartChars& messageStart ) const
711
+ bool BlockManager::WriteBlockToDisk (const CBlock& block, FlatFilePos& pos) const
712
712
{
713
713
// Open history file to append
714
714
CAutoFile fileout (OpenBlockFile (pos), SER_DISK, CLIENT_VERSION);
@@ -718,7 +718,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const
718
718
719
719
// Write index header
720
720
unsigned int nSize = GetSerializeSize (block, fileout.GetVersion ());
721
- fileout << messageStart << nSize;
721
+ fileout << GetParams (). MessageStart () << nSize;
722
722
723
723
// Write block
724
724
long fileOutPos = ftell (fileout.Get ());
@@ -740,7 +740,7 @@ bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValid
740
740
if (!FindUndoPos (state, block.nFile , _pos, ::GetSerializeSize (blockundo, CLIENT_VERSION) + 40 )) {
741
741
return error (" ConnectBlock(): FindUndoPos failed" );
742
742
}
743
- if (!UndoWriteToDisk (blockundo, _pos, block.pprev ->GetBlockHash (), GetParams (). MessageStart () )) {
743
+ if (!UndoWriteToDisk (blockundo, _pos, block.pprev ->GetBlockHash ())) {
744
744
return FatalError (m_opts.notifications , state, " Failed to write undo data" );
745
745
}
746
746
// rev files are written in block height order, whereas blk files are written as blocks come in (often out of order)
@@ -806,7 +806,7 @@ bool BlockManager::ReadBlockFromDisk(CBlock& block, const CBlockIndex& index) co
806
806
return true ;
807
807
}
808
808
809
- bool BlockManager::ReadRawBlockFromDisk (std::vector<uint8_t >& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start ) const
809
+ bool BlockManager::ReadRawBlockFromDisk (std::vector<uint8_t >& block, const FlatFilePos& pos) const
810
810
{
811
811
FlatFilePos hpos = pos;
812
812
hpos.nPos -= 8 ; // Seek back 8 bytes for meta header
@@ -821,10 +821,10 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
821
821
822
822
filein >> blk_start >> blk_size;
823
823
824
- if (memcmp (blk_start, message_start , CMessageHeader::MESSAGE_START_SIZE)) {
824
+ if (memcmp (blk_start, GetParams (). MessageStart () , CMessageHeader::MESSAGE_START_SIZE)) {
825
825
return error (" %s: Block magic mismatch for %s: %s versus expected %s" , __func__, pos.ToString (),
826
826
HexStr (blk_start),
827
- HexStr (message_start ));
827
+ HexStr (GetParams (). MessageStart () ));
828
828
}
829
829
830
830
if (blk_size > MAX_SIZE) {
@@ -859,7 +859,7 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, cons
859
859
return FlatFilePos ();
860
860
}
861
861
if (!position_known) {
862
- if (!WriteBlockToDisk (block, blockPos, GetParams (). MessageStart () )) {
862
+ if (!WriteBlockToDisk (block, blockPos)) {
863
863
m_opts.notifications .fatalError (" Failed to write block" );
864
864
return FlatFilePos ();
865
865
}
0 commit comments