diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-10-09 16:53:12 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-10-09 17:04:18 +0200 |
commit | 3a93270c55876cc88e1a3e2921e582acc6db318e (patch) | |
tree | 456af0e53fe56f234c3f447c9fc6764582985df2 /src/validation.cpp | |
parent | da0478e6e5d93d13178d098209f4397730b94065 (diff) | |
parent | b7dfc6c4b89b62f9bb79ea009ee103a6299ac005 (diff) |
Merge #11367: [rpc] getblockchaininfo: add size_on_disk, prune_target_size
b7dfc6c [rpc] getblockchaininfo: add size_on_disk, prune_target_size, automatic_pruning (Daniel Edgecumbe)
Pull request description:
Tree-SHA512: c255c27d6c922434d203ffdefda0dd3dddbd765b6a9cce5f80f5af5cb0b1c11c8aff6f4d00e96a326701d0bc81aace2f216fd1985675aa979f76c16f564a6cf6
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 7f27d8c0bf..e098de5d3d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3233,8 +3233,10 @@ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, */ /* Calculate the amount of disk space the block & undo files currently use */ -static uint64_t CalculateCurrentUsage() +uint64_t CalculateCurrentUsage() { + LOCK(cs_LastBlockFile); + uint64_t retval = 0; for (const CBlockFileInfo &file : vinfoBlockFile) { retval += file.nSize + file.nUndoSize; @@ -3245,6 +3247,8 @@ static 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) { @@ -4247,6 +4251,8 @@ std::string CBlockFileInfo::ToString() const CBlockFileInfo* GetBlockFileInfo(size_t n) { + LOCK(cs_LastBlockFile); + return &vinfoBlockFile.at(n); } |