mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge bitcoin/bitcoin#26900: refactor: Add BlockManager getters
faf7b4f1fcAdd BlockManager::IsPruneMode() (MarcoFalke)fae71fe27eAdd BlockManager::GetPruneTarget() (MarcoFalke)fa0f0436d8Add BlockManager::LoadingBlocks() (MarcoFalke) Pull request description: Requested in https://github.com/bitcoin/bitcoin/pull/25781#discussion_r1061323795, but adding getters seems unrelated from removing globals, so I split it out for now. ACKs for top commit: dergoegge: Code review ACKfaf7b4f1fcbrunoerg: crACKfaf7b4f1fcTree-SHA512: 204d0e9a0e8b78175482f89b4ce620fba0e65d8e49ad845d187af44d3843f4c733a01bac1ffe5a5319f524d8346123693a456778b69d6c75268c447eb8839642
This commit is contained in:
10
src/init.cpp
10
src/init.cpp
@@ -1499,7 +1499,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
options.mempool = Assert(node.mempool.get());
|
||||
options.reindex = node::fReindex;
|
||||
options.reindex_chainstate = fReindexChainState;
|
||||
options.prune = node::fPruneMode;
|
||||
options.prune = chainman.m_blockman.IsPruneMode();
|
||||
options.check_blocks = args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
|
||||
options.check_level = args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
|
||||
options.check_interrupt = ShutdownRequested;
|
||||
@@ -1609,7 +1609,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
|
||||
// if pruning, perform the initial blockstore prune
|
||||
// after any wallet rescanning has taken place.
|
||||
if (fPruneMode) {
|
||||
if (chainman.m_blockman.IsPruneMode()) {
|
||||
if (!fReindex) {
|
||||
LOCK(cs_main);
|
||||
for (Chainstate* chainstate : chainman.GetAll()) {
|
||||
@@ -1637,8 +1637,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
|
||||
// On first startup, warn on low block storage space
|
||||
if (!fReindex && !fReindexChainState && chain_active_height <= 1) {
|
||||
uint64_t additional_bytes_needed = fPruneMode ? nPruneTarget
|
||||
: chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024;
|
||||
uint64_t additional_bytes_needed{
|
||||
chainman.m_blockman.IsPruneMode() ?
|
||||
chainman.m_blockman.GetPruneTarget() :
|
||||
chainparams.AssumedBlockchainSize() * 1024 * 1024 * 1024};
|
||||
|
||||
if (!CheckDiskSpace(args.GetBlocksDirPath(), additional_bytes_needed)) {
|
||||
InitWarning(strprintf(_(
|
||||
|
||||
Reference in New Issue
Block a user