mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
validation: pruning for multiple chainstates
Introduces ChainstateManager::GetPruneRange(). The prune budget is split evenly between the number of chainstates, however the prune budget may be exceeded if the resulting shares are beneath `MIN_DISK_SPACE_FOR_BLOCK_FILES`.
This commit is contained in:
committed by
James O'Beirne
parent
373cf91531
commit
1019c39982
@@ -36,6 +36,7 @@ class CBlockUndo;
|
||||
class CChainParams;
|
||||
class Chainstate;
|
||||
class ChainstateManager;
|
||||
enum class ChainstateRole;
|
||||
struct CCheckpointData;
|
||||
struct FlatFilePos;
|
||||
namespace Consensus {
|
||||
@@ -138,7 +139,11 @@ private:
|
||||
bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const uint256& hashBlock) const;
|
||||
|
||||
/* Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain */
|
||||
void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeight, int chain_tip_height);
|
||||
void FindFilesToPruneManual(
|
||||
std::set<int>& setFilesToPrune,
|
||||
int nManualPruneHeight,
|
||||
const Chainstate& chain,
|
||||
ChainstateManager& chainman);
|
||||
|
||||
/**
|
||||
* Prune block and undo files (blk???.dat and rev???.dat) so that the disk space used is less than a user-defined target.
|
||||
@@ -154,8 +159,13 @@ private:
|
||||
* A db flag records the fact that at least some block files have been pruned.
|
||||
*
|
||||
* @param[out] setFilesToPrune The set of file indices that can be unlinked will be returned
|
||||
* @param last_prune The last height we're able to prune, according to the prune locks
|
||||
*/
|
||||
void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight, int chain_tip_height, int prune_height, bool is_ibd);
|
||||
void FindFilesToPrune(
|
||||
std::set<int>& setFilesToPrune,
|
||||
int last_prune,
|
||||
const Chainstate& chain,
|
||||
ChainstateManager& chainman);
|
||||
|
||||
RecursiveMutex cs_LastBlockFile;
|
||||
std::vector<CBlockFileInfo> m_blockfile_info;
|
||||
|
||||
Reference in New Issue
Block a user