Skip to content

Commit 5d59ae0

Browse files
hebastojonatack
authored andcommitted
Remove/inline ReadRawBlockFromDisk(block_data, pindex, message_start)
1 parent eaeeb88 commit 5d59ae0

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
18801880
// Fast-path: in this case it is possible to serve the block directly from disk,
18811881
// as the network format matches the format on disk
18821882
std::vector<uint8_t> block_data;
1883-
if (!ReadRawBlockFromDisk(block_data, pindex, m_chainparams.MessageStart())) {
1883+
if (!ReadRawBlockFromDisk(block_data, pindex->GetBlockPos(), m_chainparams.MessageStart())) {
18841884
assert(!"cannot load block from disk");
18851885
}
18861886
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::BLOCK, Span{block_data}));

src/node/blockstorage.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -821,17 +821,6 @@ bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos, c
821821
return true;
822822
}
823823

824-
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const CBlockIndex* pindex, const CMessageHeader::MessageStartChars& message_start)
825-
{
826-
FlatFilePos block_pos;
827-
{
828-
LOCK(cs_main);
829-
block_pos = pindex->GetBlockPos();
830-
}
831-
832-
return ReadRawBlockFromDisk(block, block_pos, message_start);
833-
}
834-
835824
/** Store block on disk. If dbp is non-nullptr, the file is known to already reside on disk */
836825
FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CChain& active_chain, const CChainParams& chainparams, const FlatFilePos* dbp)
837826
{

src/node/blockstorage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ void UnlinkPrunedFiles(const std::set<int>& setFilesToPrune);
185185
bool ReadBlockFromDisk(CBlock& block, const FlatFilePos& pos, const Consensus::Params& consensusParams);
186186
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex, const Consensus::Params& consensusParams);
187187
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const FlatFilePos& pos, const CMessageHeader::MessageStartChars& message_start);
188-
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const CBlockIndex* pindex, const CMessageHeader::MessageStartChars& message_start);
189188

190189
bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex);
191190

0 commit comments

Comments
 (0)