aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorDaniel Edgecumbe <esotericnonsense@danedgecumbe.com>2017-09-21 00:52:20 +0100
committerDaniel Edgecumbe <esotericnonsense@danedgecumbe.com>2017-09-29 19:40:50 +0100
commitb7dfc6c4b89b62f9bb79ea009ee103a6299ac005 (patch)
tree46c129303778821e49b1bd11de55ab07c62a07cc /src/validation.cpp
parentff4cd6075b12fb32b9a906deea3ed033e3f9560a (diff)
[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.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index a958afe84f..48c323698f 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);
}