refactor: move remaining LogPrintf usage outside

This commit is contained in:
Kittywhiskers Van Gogh 2024-12-15 10:15:34 +00:00
parent 04dbaa8bd8
commit 19746513b1
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
3 changed files with 14 additions and 9 deletions

View File

@ -1939,6 +1939,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
break;
}
} else {
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
LogPrintf("%s: timestamp index %s\n", __func__, fTimestampIndex ? "enabled" : "disabled");
LogPrintf("%s: spent index %s\n", __func__, fSpentIndex ? "enabled" : "disabled");
std::optional<ChainstateLoadVerifyError> rv2;
try {
uiInterface.InitMessage(_("Verifying blocks…").translated);
@ -1954,7 +1958,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
chainparams.GetConsensus(),
check_blocks,
args.GetArg("-checklevel", DEFAULT_CHECKLEVEL),
static_cast<int64_t(*)()>(GetTime));
static_cast<int64_t(*)()>(GetTime),
[](bool bls_state) {
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls_state);
});
} catch (const std::exception& e) {
LogPrintf("%s\n", e.what());
rv2 = ChainstateLoadVerifyError::ERROR_GENERIC_FAILURE;

View File

@ -133,10 +133,6 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
chainman.InitAdditionalIndexes();
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
LogPrintf("%s: timestamp index %s\n", __func__, fTimestampIndex ? "enabled" : "disabled");
LogPrintf("%s: spent index %s\n", __func__, fSpentIndex ? "enabled" : "disabled");
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
// in the past, but is now trying to run unpruned.
if (chainman.m_blockman.m_have_pruned && !fPruneMode) {
@ -277,7 +273,8 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
const Consensus::Params& consensus_params,
unsigned int check_blocks,
unsigned int check_level,
std::function<int64_t()> get_unix_time_seconds)
std::function<int64_t()> get_unix_time_seconds,
std::function<void(bool)> notify_bls_state)
{
auto is_coinsview_empty = [&](CChainState* chainstate) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
return fReset || fReindexChainState || chainstate->CoinsTip().GetBestBlock().IsNull();
@ -294,7 +291,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
const bool v19active{DeploymentActiveAfter(tip, consensus_params, Consensus::DEPLOYMENT_V19)};
if (v19active) {
bls::bls_legacy_scheme.store(false);
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load());
if (notify_bls_state) notify_bls_state(bls::bls_legacy_scheme.load());
}
if (!CVerifyDB().VerifyDB(
@ -309,7 +306,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
// Make sure we use the right scheme.
if (v19active && bls::bls_legacy_scheme.load()) {
bls::bls_legacy_scheme.store(false);
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load());
if (notify_bls_state) notify_bls_state(bls::bls_legacy_scheme.load());
}
if (check_level >= 3) {

View File

@ -156,6 +156,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
const Consensus::Params& consensus_params,
unsigned int check_blocks,
unsigned int check_level,
std::function<int64_t()> get_unix_time_seconds);
std::function<int64_t()> get_unix_time_seconds,
std::function<void(bool)> notify_bls_state = nullptr);
#endif // BITCOIN_NODE_CHAINSTATE_H