aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-01-11 11:12:40 +0000
committerglozow <gloriajzhao@gmail.com>2024-01-12 13:48:02 +0000
commiteb78ea4eebfe150bc1746282bfdad6eb0f764e3c (patch)
tree1a39b88252dbf1fed608746959e714d1e324a449 /src/kernel
parent522b8370d92a8815537b402f43951b45ed0fe7ad (diff)
downloadbitcoin-eb78ea4eebfe150bc1746282bfdad6eb0f764e3c.tar.xz
[log] mempool loading
Log at the top before incrementing so that this log isn't printed when there's only 1 tx.
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/mempool_persist.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/kernel/mempool_persist.cpp b/src/kernel/mempool_persist.cpp
index 0808d42452..cae4b04bf6 100644
--- a/src/kernel/mempool_persist.cpp
+++ b/src/kernel/mempool_persist.cpp
@@ -67,10 +67,20 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active
return false;
}
file.SetXor(xor_key);
- uint64_t num;
- file >> num;
- while (num) {
- --num;
+ uint64_t total_txns_to_load;
+ file >> total_txns_to_load;
+ uint64_t txns_tried = 0;
+ LogInfo("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) {
+ LogInfo("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;