MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ReadBlockFromDisk

Function ReadBlockFromDisk

src/persistence/block.cpp:161–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161bool ReadBlockFromDisk(const CDiskBlockPos &pos, CBlock &block) {
162 block.SetNull();
163
164 // Open history file to read
165 CAutoFile filein = CAutoFile(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION);
166 if (!filein)
167 return ERRORMSG("ReadBlockFromDisk : OpenBlockFile failed");
168
169 // Read block
170 try {
171 filein >> block;
172 } catch (std::exception &e) {
173 return ERRORMSG("Deserialize or I/O error - %s", e.what());
174 }
175
176 return true;
177}
178
179bool ReadBlockFromDisk(const CBlockIndex *pIndex, CBlock &block) {
180 if (!ReadBlockFromDisk(pIndex->GetBlockPos(), block))

Callers 15

AppInitFunction · 0.85
DisconnectBlockFunction · 0.85
ConnectBlockFunction · 0.85
DisconnectTipFunction · 0.85
ConnectTipFunction · 0.85
ProcessForkedChainFunction · 0.85
LoadBlockIndexDBFunction · 0.85
VerifyDBFunction · 0.85
PrintBlockTreeFunction · 0.85
ProcessGetDataFunction · 0.85
ReadBaseTxFromDiskFunction · 0.85
ReleadBlocksMethod · 0.85

Calls 7

CAutoFileClass · 0.85
OpenBlockFileFunction · 0.85
GetBlockPosMethod · 0.80
SetNullMethod · 0.45
whatMethod · 0.45
GetHashMethod · 0.45
GetBlockHashMethod · 0.45

Tested by 3

GetTxIndexInBlockMethod · 0.68
IsTxInTipBlockMethod · 0.68
BOOST_FIXTURE_TEST_CASEFunction · 0.68