diff options
| author | Eric Lombrozo <[email protected]> | 2013-06-23 17:47:47 -0700 |
|---|---|---|
| committer | Eric Lombrozo <[email protected]> | 2013-06-23 19:59:32 -0700 |
| commit | 226f8219422e9252cece036cf61d87738782d674 (patch) | |
| tree | 7b0d0b917383238856e24f5394a72646c6276ebf /src/main.h | |
| parent | Moved CBlock::WriteToDisk out of CBlock to inline function WriteBlockToDisk i... (diff) | |
| download | discoin-226f8219422e9252cece036cf61d87738782d674.tar.xz discoin-226f8219422e9252cece036cf61d87738782d674.zip | |
Moved WriteBlockToDisk implementation from main.h to main.cpp
Diffstat (limited to 'src/main.h')
| -rw-r--r-- | src/main.h | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/main.h b/src/main.h index bda775e84..a613613e5 100644 --- a/src/main.h +++ b/src/main.h @@ -755,31 +755,7 @@ public: /** Functions for disk access for blocks */ -inline bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos) -{ - // Open history file to append - CAutoFile fileout = CAutoFile(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); - if (!fileout) - return error("WriteBlockToDisk() : OpenBlockFile failed"); - - // Write index header - unsigned int nSize = fileout.GetSerializeSize(block); - fileout << FLATDATA(Params().MessageStart()) << nSize; - - // Write block - long fileOutPos = ftell(fileout); - if (fileOutPos < 0) - return error("WriteBlockToDisk() : ftell failed"); - pos.nPos = (unsigned int)fileOutPos; - fileout << block; - - // Flush stdio buffers and commit to disk before returning - fflush(fileout); - if (!IsInitialBlockDownload()) - FileCommit(fileout); - - return true; -} +bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos); |