| 1705 | static bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize); |
| 1706 | |
| 1707 | static 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 | |
| 1726 | static CCheckQueue<CScriptCheck> scriptcheckqueue(128); |
| 1727 |
no test coverage detected