mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
Merge bitcoin/bitcoin#25951: log: Move validation option logging to LoadChainstate()
fa4c59d65b
Move blockstorage option logging to LoadChainstate() (MacroFake)fa3358b668
Move validation option logging to LoadChainstate() (MacroFake) Pull request description: This would allow libbitcoinkernel users to see the options logged as well. Currently they would only be logged for bitcoind. Behavior change suggested in the refactoring pull https://github.com/bitcoin/bitcoin/pull/25704#discussion_r956166460 ACKs for top commit: ryanofsky: Code review ACKfa4c59d65b
. Only change since last review is moving pruning logprints out of `AppInitParameterInteraction` as suggested jonatack: Review ACKfa4c59d65b
Tree-SHA512: f27508ca06a78ef162f002d556cf830df374fe95fd4f10bf22c24b6b48276ce49f52f82ffedc43596c872ddcf08321ca03651495fd3abde16254cb8afab39d33
This commit is contained in:
commit
36e1b52511
2 changed files with 15 additions and 10 deletions
10
src/init.cpp
10
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);
|
||||
|
@ -946,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<uint64_t>::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;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,21 @@ 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());
|
||||
}
|
||||
if (nPruneTarget == 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);
|
||||
}
|
||||
|
||||
LOCK(cs_main);
|
||||
chainman.InitializeChainstate(options.mempool);
|
||||
chainman.m_total_coinstip_cache = cache_sizes.coins;
|
||||
|
|
Loading…
Add table
Reference in a new issue