0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-06 14:19:59 -05:00

[log] mempool loading

Log at the top before incrementing so that this log isn't printed when
there's only 1 tx.
This commit is contained in:
glozow 2024-01-11 11:12:40 +00:00
parent 522b8370d9
commit eb78ea4eeb

View file

@ -67,10 +67,20 @@ bool LoadMempool(CTxMemPool& pool, const fs::path& load_path, Chainstate& active
return false; return false;
} }
file.SetXor(xor_key); file.SetXor(xor_key);
uint64_t num; uint64_t total_txns_to_load;
file >> num; file >> total_txns_to_load;
while (num) { uint64_t txns_tried = 0;
--num; 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; CTransactionRef tx;
int64_t nTime; int64_t nTime;
int64_t nFeeDelta; int64_t nFeeDelta;