Skip to content

Commit cbac28b

Browse files
committed
node/chainstate: Decouple from GetTimeMillis
...instead just move it out
1 parent cb64af9 commit cbac28b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/init.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14191419

14201420
uiInterface.InitMessage(_("Loading block index…").translated);
14211421

1422+
const int64_t load_block_index_start_time = GetTimeMillis();
14221423
bool rv = LoadChainstate(fLoaded,
14231424
strLoadError,
14241425
fReset,
@@ -1432,6 +1433,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14321433
nCoinDBCache,
14331434
nCoinCacheUsage);
14341435
if (!rv) return false;
1436+
if (fLoaded) {
1437+
LogPrintf(" block index %15dms\n", GetTimeMillis() - load_block_index_start_time);
1438+
}
14351439

14361440
if (!fLoaded && !ShutdownRequested()) {
14371441
// first suggest a reindex

src/node/chainstate.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <chainparams.h> // for CChainParams
88
#include <rpc/blockchain.h> // for RPCNotifyBlockChange
9-
#include <util/time.h> // for GetTime, GetTimeMillis
9+
#include <util/time.h> // for GetTime
1010
#include <util/translation.h> // for bilingual_str
1111
#include <node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex
1212
#include <node/context.h> // for NodeContext
@@ -31,7 +31,6 @@ bool LoadChainstate(bool& fLoaded,
3131
};
3232

3333
do {
34-
const int64_t load_block_index_start_time = GetTimeMillis();
3534
try {
3635
LOCK(cs_main);
3736
chainman.InitializeChainstate(Assert(node.mempool.get()));
@@ -197,7 +196,6 @@ bool LoadChainstate(bool& fLoaded,
197196

198197
if (!failed_verification) {
199198
fLoaded = true;
200-
LogPrintf(" block index %15dms\n", GetTimeMillis() - load_block_index_start_time);
201199
}
202200
} while(false);
203201
return true;

0 commit comments

Comments
 (0)