diff options
author | glozow <gloriajzhao@gmail.com> | 2024-01-11 11:12:40 +0000 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2024-01-19 16:12:57 +0000 |
commit | 7ec34554afca9159096720de36f44707a4c628ce (patch) | |
tree | 58cc16e1fbdee1d2e50141063facfb24921ca5ee /src | |
parent | fe0f8fe8aa4a8c4dddf45f4e3519a5ded8c79ad5 (diff) |
[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: eb78ea4eebfe150bc1746282bfdad6eb0f764e3c
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/mempool_persist.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/kernel/mempool_persist.cpp b/src/kernel/mempool_persist.cpp index ff655c5ffa..f49cbe4439 100644 --- a/src/kernel/mempool_persist.cpp +++ b/src/kernel/mempool_persist.cpp @@ -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; |