From fa3358b668d8415adc1b5586caa382fe4140ad42 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Mon, 29 Aug 2022 12:11:22 +0200 Subject: [PATCH 1/2] Move validation option logging to LoadChainstate() --- src/init.cpp | 8 -------- src/node/chainstate.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 137d98026e..2eb3de54f5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -920,10 +920,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb fCheckpointsEnabled = args.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED); hashAssumeValid = uint256S(args.GetArg("-assumevalid", chainparams.GetConsensus().defaultAssumeValid.GetHex())); - if (!hashAssumeValid.IsNull()) - LogPrintf("Assuming ancestors of block %s have valid signatures.\n", hashAssumeValid.GetHex()); - else - LogPrintf("Validating signatures for all blocks.\n"); if (args.IsArgSet("-minimumchainwork")) { const std::string minChainWorkStr = args.GetArg("-minimumchainwork", ""); @@ -934,10 +930,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb } else { nMinimumChainWork = UintToArith256(chainparams.GetConsensus().nMinimumChainWork); } - LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex()); - if (nMinimumChainWork < UintToArith256(chainparams.GetConsensus().nMinimumChainWork)) { - LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainparams.GetConsensus().nMinimumChainWork.GetHex()); - } // block pruning; get the amount of disk space (in MiB) to allot for block & undo files int64_t nPruneArg = args.GetIntArg("-prune", 0); diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index ad9293f172..8e2b5c45f7 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -32,6 +32,16 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize return options.reindex || options.reindex_chainstate || chainstate->CoinsTip().GetBestBlock().IsNull(); }; + if (!hashAssumeValid.IsNull()) { + LogPrintf("Assuming ancestors of block %s have valid signatures.\n", hashAssumeValid.GetHex()); + } else { + LogPrintf("Validating signatures for all blocks.\n"); + } + LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex()); + if (nMinimumChainWork < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) { + LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex()); + } + LOCK(cs_main); chainman.InitializeChainstate(options.mempool); chainman.m_total_coinstip_cache = cache_sizes.coins; From fa4c59d65bdf1c64056b18a58f8aaa2800995aa6 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Thu, 1 Sep 2022 17:22:27 +0200 Subject: [PATCH 2/2] Move blockstorage option logging to LoadChainstate() --- src/init.cpp | 2 -- src/node/chainstate.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 2eb3de54f5..3226b42846 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -938,14 +938,12 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb } nPruneTarget = (uint64_t) nPruneArg * 1024 * 1024; if (nPruneArg == 1) { // manual pruning: -prune=1 - LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n"); nPruneTarget = std::numeric_limits::max(); fPruneMode = true; } else if (nPruneTarget) { if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) { return InitError(strprintf(_("Prune configured below the minimum of %d MiB. Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)); } - LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024); fPruneMode = true; } diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index 8e2b5c45f7..c4dd9ba6c5 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -41,6 +41,11 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize if (nMinimumChainWork < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) { LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex()); } + if (nPruneTarget == std::numeric_limits::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); + } LOCK(cs_main); chainman.InitializeChainstate(options.mempool);