node/chainstate: Decouple from GetTimeMillis

This commit is contained in:
Kittywhiskers Van Gogh 2021-09-20 17:08:18 -04:00
parent 2455c06464
commit 9ab08c42e4
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 5 additions and 3 deletions

View File

@ -1865,6 +1865,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
uiInterface.InitMessage(_("Loading block index…").translated); uiInterface.InitMessage(_("Loading block index…").translated);
const auto load_block_index_start_time{SteadyClock::now()};
bool rv = LoadChainstate(fLoaded, bool rv = LoadChainstate(fLoaded,
strLoadError, strLoadError,
fReset, fReset,
@ -1879,6 +1880,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
nCoinDBCache, nCoinDBCache,
nCoinCacheUsage); nCoinCacheUsage);
if (!rv) return false; if (!rv) return false;
if (fLoaded) {
LogPrintf(" block index %15dms\n", Ticks<std::chrono::milliseconds>(SteadyClock::now() - load_block_index_start_time));
}
if (!fLoaded && !ShutdownRequested()) { if (!fLoaded && !ShutdownRequested()) {
// first suggest a reindex // first suggest a reindex

View File

@ -7,7 +7,7 @@
#include <chainparams.h> // for CChainParams #include <chainparams.h> // for CChainParams
#include <deploymentstatus.h> // for DeploymentActiveAfter #include <deploymentstatus.h> // for DeploymentActiveAfter
#include <rpc/blockchain.h> // for RPCNotifyBlockChange #include <rpc/blockchain.h> // for RPCNotifyBlockChange
#include <util/time.h> // for GetTime, GetTimeMillis #include <util/time.h> // for GetTime
#include <util/translation.h> // for bilingual_str #include <util/translation.h> // for bilingual_str
#include <node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex #include <node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex
#include <node/context.h> // for NodeContext #include <node/context.h> // for NodeContext
@ -43,7 +43,6 @@ bool LoadChainstate(bool& fLoaded,
}; };
do { do {
const auto load_block_index_start_time{SteadyClock::now()};
try { try {
LOCK(cs_main); LOCK(cs_main);
@ -315,7 +314,6 @@ bool LoadChainstate(bool& fLoaded,
if (!failed_verification) { if (!failed_verification) {
fLoaded = true; fLoaded = true;
LogPrintf(" block index %15dms\n", Ticks<std::chrono::milliseconds>(SteadyClock::now() - load_block_index_start_time));
} }
} while(false); } while(false);
return true; return true;