diff options
| author | Daniel Edgecumbe <[email protected]> | 2017-09-21 00:52:20 +0100 |
|---|---|---|
| committer | Patrick Lodder <[email protected]> | 2020-07-24 18:45:39 +0200 |
| commit | 59dcceea58529c10e3d9eecec92fd3c854350afa (patch) | |
| tree | dbad0caae9e743eb0d720f1fe6104ab7e21bde24 /src/validation.cpp | |
| parent | Merge pull request #1636 from patricklodder/1.14-fix-tests (diff) | |
| download | discoin-59dcceea58529c10e3d9eecec92fd3c854350afa.tar.xz discoin-59dcceea58529c10e3d9eecec92fd3c854350afa.zip | |
[backport] [rpc] getblockchaininfo: add size_on_disk, prune_target_size, automatic_pruning
Fix pruneheight help text.
Move fPruneMode block to match output ordering with help text.
Add functional tests for new fields in getblockchaininfo.
Rebase-from: bitcoin#b7dfc6c4
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); } |