Skip to content

Commit a9d10f8

Browse files
fanquakevijaydasmp
authored andcommitted
Merge bitcoin#28191: refactor: Remove unused MessageStartChars parameters from BlockManager methods
fa69e3a Remove unused MessageStartChars parameters from BlockManager methods (MarcoFalke) Pull request description: Seems odd to expose these for mocking, when it is not needed. Fix this by removing the the unused parameters and use the already existing member field instead. ACKs for top commit: Empact: utACK fa69e3a dergoegge: utACK fa69e3a Tree-SHA512: 7814e9560abba8d9c0926bcffc70f92e502d22f543af43671248f6fcd1433f35238553c0f05123fde6d8e0f80261af0ab0500927548115153bd68d57fe2da746
1 parent 468a8d4 commit a9d10f8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/node/blockstorage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ CBlockFileInfo* BlockManager::GetBlockFileInfo(size_t n)
484484
return &m_blockfile_info.at(n);
485485
}
486486

487-
static bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart)
487+
static bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock)
488488
{
489489
// Open history file to append
490490
CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION);
@@ -494,7 +494,7 @@ static bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const
494494

495495
// Write index header
496496
unsigned int nSize = GetSerializeSize(blockundo, fileout.GetVersion());
497-
fileout << messageStart << nSize;
497+
fileout << chainparams().MessageStart() << nSize;
498498

499499
// Write undo data
500500
long fileOutPos = ftell(fileout.Get());
@@ -692,7 +692,7 @@ bool BlockManager::FindUndoPos(BlockValidationState& state, int nFile, FlatFileP
692692
return true;
693693
}
694694

695-
static bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const CMessageHeader::MessageStartChars& messageStart)
695+
static bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos)
696696
{
697697
// Open history file to append
698698
CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION);
@@ -702,7 +702,7 @@ static bool WriteBlockToDisk(const CBlock& block, FlatFilePos& pos, const CMessa
702702

703703
// Write index header
704704
unsigned int nSize = GetSerializeSize(block, fileout.GetVersion());
705-
fileout << messageStart << nSize;
705+
fileout << chainparams().MessageStart() << nSize;
706706

707707
// Write block
708708
long fileOutPos = ftell(fileout.Get());
@@ -724,7 +724,7 @@ bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValid
724724
if (!FindUndoPos(state, pindex->nFile, _pos, ::GetSerializeSize(blockundo, CLIENT_VERSION) + 40)) {
725725
return error("ConnectBlock(): FindUndoPos failed");
726726
}
727-
if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart())) {
727+
if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash())) {
728728
return AbortNode(state, "Failed to write undo data");
729729
}
730730
// rev files are written in block height order, whereas blk files are written as blocks come in (often out of order)
@@ -802,7 +802,7 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
802802
return FlatFilePos();
803803
}
804804
if (!position_known) {
805-
if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart())) {
805+
if (!WriteBlockToDisk(block, blockPos)) {
806806
AbortNode("Failed to write block");
807807
return FlatFilePos();
808808
}

0 commit comments

Comments
 (0)