MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / WriteUndoDataForBlock

Function WriteUndoDataForBlock

src/validation.cpp:1707–1724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1705static bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
1706
1707static bool WriteUndoDataForBlock(const CBlockUndo& blockundo, CValidationState& state, CBlockIndex* pindex, const CChainParams& chainparams)
1708{
1709 // Write undo information to disk
1710 if (pindex->GetUndoPos().IsNull()) {
1711 CDiskBlockPos _pos;
1712 if (!FindUndoPos(state, pindex->nFile, _pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40))
1713 return error("ConnectBlock(): FindUndoPos failed");
1714 if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart()))
1715 return AbortNode(state, "Failed to write undo data");
1716
1717 // update nUndoPos in block index
1718 pindex->nUndoPos = _pos.nPos;
1719 pindex->nStatus |= BLOCK_HAVE_UNDO;
1720 setDirtyBlockIndex.insert(pindex);
1721 }
1722
1723 return true;
1724}
1725
1726static CCheckQueue<CScriptCheck> scriptcheckqueue(128);
1727

Callers 1

ConnectBlockMethod · 0.85

Calls 9

FindUndoPosFunction · 0.85
GetSerializeSizeFunction · 0.85
errorFunction · 0.85
UndoWriteToDiskFunction · 0.85
AbortNodeFunction · 0.85
GetUndoPosMethod · 0.80
IsNullMethod · 0.45
GetBlockHashMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected