Skip to content

Commit 9ab08c4

Browse files
committed
node/chainstate: Decouple from GetTimeMillis
1 parent 2455c06 commit 9ab08c4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/init.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
18651865

18661866
uiInterface.InitMessage(_("Loading block index…").translated);
18671867

1868+
const auto load_block_index_start_time{SteadyClock::now()};
18681869
bool rv = LoadChainstate(fLoaded,
18691870
strLoadError,
18701871
fReset,
@@ -1879,6 +1880,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
18791880
nCoinDBCache,
18801881
nCoinCacheUsage);
18811882
if (!rv) return false;
1883+
if (fLoaded) {
1884+
LogPrintf(" block index %15dms\n", Ticks<std::chrono::milliseconds>(SteadyClock::now() - load_block_index_start_time));
1885+
}
18821886

18831887
if (!fLoaded && !ShutdownRequested()) {
18841888
// first suggest a reindex

src/node/chainstate.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <chainparams.h> // for CChainParams
88
#include <deploymentstatus.h> // for DeploymentActiveAfter
99
#include <rpc/blockchain.h> // for RPCNotifyBlockChange
10-
#include <util/time.h> // for GetTime, GetTimeMillis
10+
#include <util/time.h> // for GetTime
1111
#include <util/translation.h> // for bilingual_str
1212
#include <node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex
1313
#include <node/context.h> // for NodeContext
@@ -43,7 +43,6 @@ bool LoadChainstate(bool& fLoaded,
4343
};
4444

4545
do {
46-
const auto load_block_index_start_time{SteadyClock::now()};
4746
try {
4847
LOCK(cs_main);
4948

@@ -315,7 +314,6 @@ bool LoadChainstate(bool& fLoaded,
315314

316315
if (!failed_verification) {
317316
fLoaded = true;
318-
LogPrintf(" block index %15dms\n", Ticks<std::chrono::milliseconds>(SteadyClock::now() - load_block_index_start_time));
319317
}
320318
} while(false);
321319
return true;

0 commit comments

Comments
 (0)