@@ -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 ());
@@ -707,7 +707,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
707
707
return true ;
708
708
}
709
709
710
- bool BlockManager::WriteBlockToDisk (const CBlock& block, FlatFilePos& pos, const CMessageHeader::MessageStartChars& messageStart ) const
710
+ bool BlockManager::WriteBlockToDisk (const CBlock& block, FlatFilePos& pos) const
711
711
{
712
712
// Open history file to append
713
713
CAutoFile fileout (OpenBlockFile (pos), SER_DISK, CLIENT_VERSION);
@@ -717,7 +717,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const
717
717
718
718
// Write index header
719
719
unsigned int nSize = GetSerializeSize (block, fileout.GetVersion ());
720
- fileout << messageStart << nSize;
720
+ fileout << GetParams (). MessageStart () << nSize;
721
721
722
722
// Write block
723
723
long fileOutPos = ftell (fileout.Get ());
@@ -739,7 +739,7 @@ bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValid
739
739
if (!FindUndoPos (state, block.nFile , _pos, ::GetSerializeSize (blockundo, CLIENT_VERSION) + 40 )) {
740
740
return error (" ConnectBlock(): FindUndoPos failed" );
741
741
}
742
- if (!UndoWriteToDisk (blockundo, _pos, block.pprev ->GetBlockHash (), GetParams (). MessageStart () )) {
742
+ if (!UndoWriteToDisk (blockundo, _pos, block.pprev ->GetBlockHash ())) {
743
743
return FatalError (m_opts.notifications , state, " Failed to write undo data" );
744
744
}
745
745
// 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
804
804
return true ;
805
805
}
806
806
807
- bool BlockManager::ReadRawBlockFromDisk (std::vector<uint8_t >& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start ) const
807
+ bool BlockManager::ReadRawBlockFromDisk (std::vector<uint8_t >& block, const FlatFilePos& pos) const
808
808
{
809
809
FlatFilePos hpos = pos;
810
810
hpos.nPos -= 8 ; // Seek back 8 bytes for meta header
@@ -819,10 +819,10 @@ bool BlockManager::ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatF
819
819
820
820
filein >> blk_start >> blk_size;
821
821
822
- if (memcmp (blk_start, message_start , CMessageHeader::MESSAGE_START_SIZE)) {
822
+ if (memcmp (blk_start, GetParams (). MessageStart () , CMessageHeader::MESSAGE_START_SIZE)) {
823
823
return error (" %s: Block magic mismatch for %s: %s versus expected %s" , __func__, pos.ToString (),
824
824
HexStr (blk_start),
825
- HexStr (message_start ));
825
+ HexStr (GetParams (). MessageStart () ));
826
826
}
827
827
828
828
if (blk_size > MAX_SIZE) {
@@ -857,7 +857,7 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
857
857
return FlatFilePos ();
858
858
}
859
859
if (!position_known) {
860
- if (!WriteBlockToDisk (block, blockPos, GetParams (). MessageStart () )) {
860
+ if (!WriteBlockToDisk (block, blockPos)) {
861
861
m_opts.notifications .fatalError (" Failed to write block" );
862
862
return FlatFilePos ();
863
863
}
0 commit comments