Skip to content

Commit 7ec3455

Browse files
committed
[log] mempool loading
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
1 parent fe0f8fe commit 7ec3455

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/kernel/mempool_persist.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,20 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active
6060
if (version != MEMPOOL_DUMP_VERSION) {
6161
return false;
6262
}
63-
uint64_t num;
64-
file >> num;
65-
while (num) {
66-
--num;
63+
uint64_t total_txns_to_load;
64+
file >> total_txns_to_load;
65+
uint64_t txns_tried = 0;
66+
LogPrintf("Loading %u mempool transactions from disk...\n", total_txns_to_load);
67+
int next_tenth_to_report = 0;
68+
while (txns_tried < total_txns_to_load) {
69+
const int percentage_done(100.0 * txns_tried / total_txns_to_load);
70+
if (next_tenth_to_report < percentage_done / 10) {
71+
LogPrintf("Progress loading mempool transactions from disk: %d%% (tried %u, %u remaining)\n",
72+
percentage_done, txns_tried, total_txns_to_load - txns_tried);
73+
next_tenth_to_report = percentage_done / 10;
74+
}
75+
++txns_tried;
76+
6777
CTransactionRef tx;
6878
int64_t nTime;
6979
int64_t nFeeDelta;

0 commit comments

Comments
 (0)