Skip to content

Commit 1974651

Browse files
committed
refactor: move remaining LogPrintf usage outside
1 parent 04dbaa8 commit 1974651

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/init.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
19391939
break;
19401940
}
19411941
} else {
1942+
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
1943+
LogPrintf("%s: timestamp index %s\n", __func__, fTimestampIndex ? "enabled" : "disabled");
1944+
LogPrintf("%s: spent index %s\n", __func__, fSpentIndex ? "enabled" : "disabled");
1945+
19421946
std::optional<ChainstateLoadVerifyError> rv2;
19431947
try {
19441948
uiInterface.InitMessage(_("Verifying blocks…").translated);
@@ -1954,7 +1958,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
19541958
chainparams.GetConsensus(),
19551959
check_blocks,
19561960
args.GetArg("-checklevel", DEFAULT_CHECKLEVEL),
1957-
static_cast<int64_t(*)()>(GetTime));
1961+
static_cast<int64_t(*)()>(GetTime),
1962+
[](bool bls_state) {
1963+
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls_state);
1964+
});
19581965
} catch (const std::exception& e) {
19591966
LogPrintf("%s\n", e.what());
19601967
rv2 = ChainstateLoadVerifyError::ERROR_GENERIC_FAILURE;

src/node/chainstate.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
133133

134134
chainman.InitAdditionalIndexes();
135135

136-
LogPrintf("%s: address index %s\n", __func__, fAddressIndex ? "enabled" : "disabled");
137-
LogPrintf("%s: timestamp index %s\n", __func__, fTimestampIndex ? "enabled" : "disabled");
138-
LogPrintf("%s: spent index %s\n", __func__, fSpentIndex ? "enabled" : "disabled");
139-
140136
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
141137
// in the past, but is now trying to run unpruned.
142138
if (chainman.m_blockman.m_have_pruned && !fPruneMode) {
@@ -277,7 +273,8 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
277273
const Consensus::Params& consensus_params,
278274
unsigned int check_blocks,
279275
unsigned int check_level,
280-
std::function<int64_t()> get_unix_time_seconds)
276+
std::function<int64_t()> get_unix_time_seconds,
277+
std::function<void(bool)> notify_bls_state)
281278
{
282279
auto is_coinsview_empty = [&](CChainState* chainstate) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
283280
return fReset || fReindexChainState || chainstate->CoinsTip().GetBestBlock().IsNull();
@@ -294,7 +291,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
294291
const bool v19active{DeploymentActiveAfter(tip, consensus_params, Consensus::DEPLOYMENT_V19)};
295292
if (v19active) {
296293
bls::bls_legacy_scheme.store(false);
297-
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load());
294+
if (notify_bls_state) notify_bls_state(bls::bls_legacy_scheme.load());
298295
}
299296

300297
if (!CVerifyDB().VerifyDB(
@@ -309,7 +306,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
309306
// Make sure we use the right scheme.
310307
if (v19active && bls::bls_legacy_scheme.load()) {
311308
bls::bls_legacy_scheme.store(false);
312-
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load());
309+
if (notify_bls_state) notify_bls_state(bls::bls_legacy_scheme.load());
313310
}
314311

315312
if (check_level >= 3) {

src/node/chainstate.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
156156
const Consensus::Params& consensus_params,
157157
unsigned int check_blocks,
158158
unsigned int check_level,
159-
std::function<int64_t()> get_unix_time_seconds);
159+
std::function<int64_t()> get_unix_time_seconds,
160+
std::function<void(bool)> notify_bls_state = nullptr);
160161

161162
#endif // BITCOIN_NODE_CHAINSTATE_H

0 commit comments

Comments
 (0)