You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block
file pruning. When pruning is enabled, block and undo files will be deleted to
try to keep total space used by those files to below the prune target (N, in
MB) specified by the user, subject to some constraints:
- The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP),
- N must be at least 550MB (chosen as a value for the target that could
reasonably be met, with some assumptions about block sizes, orphan rates,
etc; see comment in main.h),
- No blocks are pruned until chainActive is at least 100,000 blocks long (on
mainnet; defined separately for mainnet, testnet, and regtest in chainparams
as nPruneAfterHeight).
This unsets NODE_NETWORK if pruning is enabled.
Also included is an RPC test for pruning (pruning.py).
Thanks to @rdponticelli for earlier work on this feature; this is based in
part off that work.
strUsage += HelpMessageOpt("-reindex", _("Rebuild block chain index from current blk000??.dat files") + "" + _("on startup"));
278
+
strUsage += HelpMessageOpt("-prune=<n>", _("Reduce storage requirements by pruning (deleting) old blocks. This mode disables wallet support and is incompatible with -txindex.") + "" +
279
+
_("Warning: Reverting this setting requires re-downloading the entire blockchain.") + "" +
280
+
_("(default: 0 = disable pruning blocks,") + "" +
281
+
strprintf(_(">%u = target size in MiB to use for block files)"), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
282
+
strUsage += HelpMessageOpt("-reindex", _("Rebuild block chain index from current blk000??.dat files") + "" + _("on startup"));
283
+
279
284
#if !defined(WIN32)
280
285
strUsage += HelpMessageOpt("-sysperms", _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)"));
returnInitError(_("Prune cannot be configured with a negative value."));
761
+
}
762
+
nPruneTarget = (uint64_t) nSignedPruneTarget;
763
+
if (nPruneTarget) {
764
+
if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
765
+
returnInitError(strprintf(_("Prune configured below the minimum of %d MB. Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
766
+
}
767
+
LogPrintf("Prune configured to target %uMiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
0 commit comments