diff options
| author | Patrick Lodder <[email protected]> | 2020-08-06 09:57:09 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-08-06 09:57:09 +0200 |
| commit | cf79da3f96d5feaa39c3f0dd92377ac2c13f4115 (patch) | |
| tree | aebb4348a17f9e50051f57cbd65cbc3d62bb9796 /src/validation.cpp | |
| parent | Merge pull request #1629 from ftab/1628-fix-dogecoin-links (diff) | |
| parent | [backport] [rpc] getblockchaininfo: add size_on_disk, prune_target_size, auto... (diff) | |
| download | discoin-cf79da3f96d5feaa39c3f0dd92377ac2c13f4115.tar.xz discoin-cf79da3f96d5feaa39c3f0dd92377ac2c13f4115.zip | |
Merge pull request #1637 from patricklodder/disk_size_and_pruning
Add size_on_disk and addl pruning fields to getblockchaininfo
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 5b27b9ec5..3ddf67717 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3356,6 +3356,8 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, /* Calculate the amount of disk space the block & undo files currently use */ uint64_t CalculateCurrentUsage() { + LOCK(cs_LastBlockFile); + uint64_t retval = 0; BOOST_FOREACH(const CBlockFileInfo &file, vinfoBlockFile) { retval += file.nSize + file.nUndoSize; @@ -3366,6 +3368,8 @@ uint64_t CalculateCurrentUsage() /* Prune a block file (modify associated database entries)*/ void PruneOneBlockFile(const int fileNumber) { + LOCK(cs_LastBlockFile); + for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); ++it) { CBlockIndex* pindex = it->second; if (pindex->nFile == fileNumber) { @@ -4231,6 +4235,8 @@ std::string CBlockFileInfo::ToString() const CBlockFileInfo* GetBlockFileInfo(size_t n) { + LOCK(cs_LastBlockFile); + return &vinfoBlockFile.at(n); } |