diff options
| author | Pieter Wuille <[email protected]> | 2012-10-20 14:49:33 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2012-10-20 14:49:33 -0700 |
| commit | cf9b49fa50f439e57896ce2c176214052833a09a (patch) | |
| tree | 7c0df7313bf492b67bd629a01d28074f22af4104 /src/util.cpp | |
| parent | Merge pull request #1880 from sipa/threadimport (diff) | |
| parent | Remove BDB block database support (diff) | |
| download | discoin-cf9b49fa50f439e57896ce2c176214052833a09a.tar.xz discoin-cf9b49fa50f439e57896ce2c176214052833a09a.zip | |
Merge pull request #1677 from sipa/ultraprune
Ultraprune: use a pruned-txout-set database for block validation
Diffstat (limited to 'src/util.cpp')
| -rw-r--r-- | src/util.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index c72b84bfa..916288645 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1137,6 +1137,20 @@ int GetFilesize(FILE* file) return nFilesize; } +// this function tries to make a particular range of a file allocated (corresponding to disk space) +// it is advisory, and the range specified in the arguments will never contain live data +void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) { + static const char buf[65536] = {}; + fseek(file, offset, SEEK_SET); + while (length > 0) { + unsigned int now = 65536; + if (length < now) + now = length; + fwrite(buf, 1, now, file); // allowed to fail; this function is advisory anyway + length -= now; + } +} + void ShrinkDebugFile() { // Scroll debug.log if it's getting too big |