Skip to content

Commit

Permalink
[log] mempool loading
Browse files Browse the repository at this point in the history
Log at the top before incrementing so that this log isn't printed when
there's only 1 tx.

Github-Pull: #29227
Rebased-From: eb78ea4
  • Loading branch information
glozow committed Jan 19, 2024
1 parent fe0f8fe commit 7ec3455
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/kernel/mempool_persist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,20 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active
if (version != MEMPOOL_DUMP_VERSION) {
return false;
}
uint64_t num;
file >> num;
while (num) {
--num;
uint64_t total_txns_to_load;
file >> total_txns_to_load;
uint64_t txns_tried = 0;
LogPrintf("Loading %u mempool transactions from disk...\n", total_txns_to_load);
int next_tenth_to_report = 0;
while (txns_tried < total_txns_to_load) {
const int percentage_done(100.0 * txns_tried / total_txns_to_load);
if (next_tenth_to_report < percentage_done / 10) {
LogPrintf("Progress loading mempool transactions from disk: %d%% (tried %u, %u remaining)\n",
percentage_done, txns_tried, total_txns_to_load - txns_tried);
next_tenth_to_report = percentage_done / 10;
}
++txns_tried;

CTransactionRef tx;
int64_t nTime;
int64_t nFeeDelta;
Expand Down

0 comments on commit 7ec3455

Please sign in to comment.