Skip to content

Commit

Permalink
mempool: Log added for dumping mempool transactions to disk
Browse files Browse the repository at this point in the history
  • Loading branch information
kevkevinpal committed Feb 14, 2024
1 parent 1d334d8 commit cc9a685
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/kernel/mempool_persist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mock
}
file.SetXor(xor_key);

file << (uint64_t)vinfo.size();
uint64_t mempool_transactions_to_write(vinfo.size());
file << mempool_transactions_to_write;
LogInfo("Writing %u mempool transactions to disk...\n", mempool_transactions_to_write);
for (const auto& i : vinfo) {
file << TX_WITH_WITNESS(*(i.tx));
file << int64_t{count_seconds(i.m_time)};
Expand All @@ -194,7 +196,7 @@ bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mock

file << mapDeltas;

LogPrintf("Writing %d unbroadcast transactions to disk.\n", unbroadcast_txids.size());
LogPrintf("Writing %d unbroadcast transactions to file.\n", unbroadcast_txids.size());
file << unbroadcast_txids;

if (!skip_file_commit && !FileCommit(file.Get()))
Expand All @@ -205,9 +207,11 @@ bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mock
}
auto last = SteadyClock::now();

LogPrintf("Dumped mempool: %.3fs to copy, %.3fs to dump\n",
LogPrintf("Dumped mempool: %.3fs to copy, %.3fs to dump, %.3f MB dumped to file\n",
Ticks<SecondsDouble>(mid - start),
Ticks<SecondsDouble>(last - mid));
Ticks<SecondsDouble>(last - mid),
(float)file_size(dump_path)/1000000);

} catch (const std::exception& e) {
LogPrintf("Failed to dump mempool: %s. Continuing anyway.\n", e.what());
return false;
Expand Down

0 comments on commit cc9a685

Please sign in to comment.