Skip to content

Commit 36e1b52

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25951: log: Move validation option logging to LoadChainstate()
fa4c59d Move blockstorage option logging to LoadChainstate() (MacroFake) fa3358b 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 bitcoin/bitcoin#25704 (comment) ACKs for top commit: ryanofsky: Code review ACK fa4c59d. Only change since last review is moving pruning logprints out of `AppInitParameterInteraction` as suggested jonatack: Review ACK fa4c59d Tree-SHA512: f27508ca06a78ef162f002d556cf830df374fe95fd4f10bf22c24b6b48276ce49f52f82ffedc43596c872ddcf08321ca03651495fd3abde16254cb8afab39d33
2 parents 3118425 + fa4c59d commit 36e1b52

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/init.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -920,10 +920,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
920920
fCheckpointsEnabled = args.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED);
921921

922922
hashAssumeValid = uint256S(args.GetArg("-assumevalid", chainparams.GetConsensus().defaultAssumeValid.GetHex()));
923-
if (!hashAssumeValid.IsNull())
924-
LogPrintf("Assuming ancestors of block %s have valid signatures.\n", hashAssumeValid.GetHex());
925-
else
926-
LogPrintf("Validating signatures for all blocks.\n");
927923

928924
if (args.IsArgSet("-minimumchainwork")) {
929925
const std::string minChainWorkStr = args.GetArg("-minimumchainwork", "");
@@ -934,10 +930,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
934930
} else {
935931
nMinimumChainWork = UintToArith256(chainparams.GetConsensus().nMinimumChainWork);
936932
}
937-
LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex());
938-
if (nMinimumChainWork < UintToArith256(chainparams.GetConsensus().nMinimumChainWork)) {
939-
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainparams.GetConsensus().nMinimumChainWork.GetHex());
940-
}
941933

942934
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
943935
int64_t nPruneArg = args.GetIntArg("-prune", 0);
@@ -946,14 +938,12 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
946938
}
947939
nPruneTarget = (uint64_t) nPruneArg * 1024 * 1024;
948940
if (nPruneArg == 1) { // manual pruning: -prune=1
949-
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
950941
nPruneTarget = std::numeric_limits<uint64_t>::max();
951942
fPruneMode = true;
952943
} else if (nPruneTarget) {
953944
if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
954945
return InitError(strprintf(_("Prune configured below the minimum of %d MiB. Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
955946
}
956-
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
957947
fPruneMode = true;
958948
}
959949

src/node/chainstate.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
3232
return options.reindex || options.reindex_chainstate || chainstate->CoinsTip().GetBestBlock().IsNull();
3333
};
3434

35+
if (!hashAssumeValid.IsNull()) {
36+
LogPrintf("Assuming ancestors of block %s have valid signatures.\n", hashAssumeValid.GetHex());
37+
} else {
38+
LogPrintf("Validating signatures for all blocks.\n");
39+
}
40+
LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex());
41+
if (nMinimumChainWork < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) {
42+
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
43+
}
44+
if (nPruneTarget == std::numeric_limits<uint64_t>::max()) {
45+
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
46+
} else if (nPruneTarget) {
47+
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
48+
}
49+
3550
LOCK(cs_main);
3651
chainman.InitializeChainstate(options.mempool);
3752
chainman.m_total_coinstip_cache = cache_sizes.coins;

0 commit comments

Comments
 (0)