Skip to content

Commit

Permalink
node/chainstate: Decouple from GetTimeMillis
Browse files Browse the repository at this point in the history
Summary:
```
...instead just move it out
```

Partial backport of [[bitcoin/bitcoin#23280 | core#23280]]:
bitcoin/bitcoin@cbac28b

Depends on D12555.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D12556
  • Loading branch information
dongcarl authored and Fabcien committed Nov 21, 2022
1 parent af94e52 commit d0f1c29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,11 +2654,17 @@ bool AppInitMain(Config &config, RPCServer &rpcServer,

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

const int64_t load_block_index_start_time = GetTimeMillis();

if (!LoadChainstate(fLoaded, strLoadError, fReset, chainman, node,
fPruneMode, config, args, fReindexChainState,
nBlockTreeDBCache, nCoinDBCache, nCoinCacheUsage)) {
return false;
}
if (fLoaded) {
LogPrintf(" block index %15dms\n",
GetTimeMillis() - load_block_index_start_time);
}

if (!fLoaded && !ShutdownRequested()) {
// first suggest a reindex
Expand Down
3 changes: 0 additions & 3 deletions src/node/chainstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ bool LoadChainstate(bool &fLoaded, bilingual_str &strLoadError, bool fReset,

do {
bool failed_verification = false;
const int64_t load_block_index_start_time = GetTimeMillis();
try {
LOCK(cs_main);
chainman.InitializeChainstate(Assert(node.mempool.get()));
Expand Down Expand Up @@ -215,8 +214,6 @@ bool LoadChainstate(bool &fLoaded, bilingual_str &strLoadError, bool fReset,

if (!failed_verification) {
fLoaded = true;
LogPrintf(" block index %15dms\n",
GetTimeMillis() - load_block_index_start_time);
}
} while (false);

Expand Down

0 comments on commit d0f1c29

Please sign in to comment.