Skip to content

Commit eb78ea4

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.
1 parent 522b837 commit eb78ea4

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
@@ -67,10 +67,20 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active
6767
return false;
6868
}
6969
file.SetXor(xor_key);
70-
uint64_t num;
71-
file >> num;
72-
while (num) {
73-
--num;
70+
uint64_t total_txns_to_load;
71+
file >> total_txns_to_load;
72+
uint64_t txns_tried = 0;
73+
LogInfo("Loading %u mempool transactions from disk...\n", total_txns_to_load);
74+
int next_tenth_to_report = 0;
75+
while (txns_tried < total_txns_to_load) {
76+
const int percentage_done(100.0 * txns_tried / total_txns_to_load);
77+
if (next_tenth_to_report < percentage_done / 10) {
78+
LogInfo("Progress loading mempool transactions from disk: %d%% (tried %u, %u remaining)\n",
79+
percentage_done, txns_tried, total_txns_to_load - txns_tried);
80+
next_tenth_to_report = percentage_done / 10;
81+
}
82+
++txns_tried;
83+
7484
CTransactionRef tx;
7585
int64_t nTime;
7686
int64_t nFeeDelta;

0 commit comments

Comments
 (0)