Undo for tmp files
This commit is contained in:
16
src/main.cpp
16
src/main.cpp
@@ -4637,18 +4637,18 @@ bool FindBlockPos(int32_t tmpflag,CValidationState &state, CDiskBlockPos &pos, u
|
|||||||
|
|
||||||
bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize)
|
bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize)
|
||||||
{
|
{
|
||||||
|
std::vector<CBlockFileInfo> *ptr; int *lastfilep;
|
||||||
|
LOCK(cs_LastBlockFile);
|
||||||
if ( nFile >= TMPFILE_START )
|
if ( nFile >= TMPFILE_START )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"FindUndoPos unexpected tmpfile %d\n",nFile);
|
nFile %= TMPFILE_START;
|
||||||
return(false);
|
ptr = &tmpBlockFiles;
|
||||||
}
|
} else ptr = &vinfoBlockFile;
|
||||||
|
|
||||||
pos.nFile = nFile;
|
pos.nFile = nFile;
|
||||||
|
|
||||||
LOCK(cs_LastBlockFile);
|
|
||||||
|
|
||||||
unsigned int nNewSize;
|
unsigned int nNewSize;
|
||||||
pos.nPos = vinfoBlockFile[nFile].nUndoSize;
|
pos.nPos = (*ptr)[nFile].nUndoSize;
|
||||||
nNewSize = vinfoBlockFile[nFile].nUndoSize += nAddSize;
|
nNewSize = (*ptr)[nFile].nUndoSize += nAddSize;
|
||||||
setDirtyFileInfo.insert(nFile);
|
setDirtyFileInfo.insert(nFile);
|
||||||
|
|
||||||
unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE;
|
unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE;
|
||||||
|
|||||||
Reference in New Issue
Block a user