mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Add BlockManager::GetPruneTarget()
This commit is contained in:
@@ -51,7 +51,6 @@ extern std::atomic_bool fReindex;
|
||||
/** Pruning-related variables and constants */
|
||||
/** True if we're running in -prune mode. */
|
||||
extern bool fPruneMode;
|
||||
/** Number of bytes of block files that we're trying to stay below. */
|
||||
extern uint64_t nPruneTarget;
|
||||
|
||||
// Because validation code takes pointers to the map's CBlockIndex objects, if
|
||||
@@ -176,6 +175,9 @@ public:
|
||||
/** Store block on disk. If dbp is not nullptr, then it provides the known position of the block within a block file on disk. */
|
||||
FlatFilePos SaveBlockToDisk(const CBlock& block, int nHeight, CChain& active_chain, const CChainParams& chainparams, const FlatFilePos* dbp);
|
||||
|
||||
/** Attempt to stay below this number of bytes of block files. */
|
||||
[[nodiscard]] uint64_t GetPruneTarget() const { return nPruneTarget; }
|
||||
|
||||
[[nodiscard]] bool LoadingBlocks() const
|
||||
{
|
||||
return fImporting || fReindex;
|
||||
|
||||
@@ -44,10 +44,10 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
|
||||
if (chainman.MinimumChainWork() < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) {
|
||||
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
|
||||
}
|
||||
if (nPruneTarget == std::numeric_limits<uint64_t>::max()) {
|
||||
if (chainman.m_blockman.GetPruneTarget() == std::numeric_limits<uint64_t>::max()) {
|
||||
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
|
||||
} else if (nPruneTarget) {
|
||||
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
|
||||
} else if (chainman.m_blockman.GetPruneTarget()) {
|
||||
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", chainman.m_blockman.GetPruneTarget() / 1024 / 1024);
|
||||
}
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
Reference in New Issue
Block a user