Skip to content

Commit 6e3c439

Browse files
committed
mempool: Improve logging of replaced transactions
1 parent d3466e4 commit 6e3c439

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/validation.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,13 +1294,15 @@ bool MemPoolAccept::Finalize(const ATMPArgs& args, Workspace& ws)
12941294
// Remove conflicting transactions from the mempool
12951295
for (CTxMemPool::txiter it : m_subpackage.m_all_conflicts)
12961296
{
1297-
LogPrint(BCLog::MEMPOOL, "replacing tx %s (wtxid=%s) with %s (wtxid=%s) for %s additional fees, %d delta bytes\n",
1297+
LogPrint(BCLog::MEMPOOL, "replacing mempool tx %s (wtxid=%s, fees=%s, vsize=%s). New tx %s (wtxid=%s, fees=%s, vsize=%s)\n",
12981298
it->GetTx().GetHash().ToString(),
12991299
it->GetTx().GetWitnessHash().ToString(),
1300+
it->GetFee(),
1301+
it->GetTxSize(),
13001302
hash.ToString(),
13011303
tx.GetWitnessHash().ToString(),
1302-
FormatMoney(ws.m_modified_fees - m_subpackage.m_conflicting_fees),
1303-
(int)entry->GetTxSize() - (int)m_subpackage.m_conflicting_size);
1304+
entry->GetFee(),
1305+
entry->GetTxSize());
13041306
TRACE7(mempool, replaced,
13051307
it->GetTx().GetHash().data(),
13061308
it->GetTxSize(),
@@ -1394,6 +1396,13 @@ bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>&
13941396
std::transform(workspaces.cbegin(), workspaces.cend(), std::back_inserter(all_package_wtxids),
13951397
[](const auto& ws) { return ws.m_ptx->GetWitnessHash(); });
13961398

1399+
if (!m_subpackage.m_replaced_transactions.empty()) {
1400+
LogPrint(BCLog::MEMPOOL, "replaced %u mempool transactions with %u new one(s) for %s additional fees, %d delta bytes\n",
1401+
m_subpackage.m_replaced_transactions.size(), workspaces.size(),
1402+
m_subpackage.m_total_modified_fees - m_subpackage.m_conflicting_fees,
1403+
m_subpackage.m_total_vsize - static_cast<int>(m_subpackage.m_conflicting_size));
1404+
}
1405+
13971406
// Add successful results. The returned results may change later if LimitMempoolSize() evicts them.
13981407
for (Workspace& ws : workspaces) {
13991408
const auto effective_feerate = args.m_package_feerates ? ws.m_package_feerate :
@@ -1475,6 +1484,13 @@ MempoolAcceptResult MemPoolAccept::AcceptSingleTransaction(const CTransactionRef
14751484
m_pool.m_opts.signals->TransactionAddedToMempool(tx_info, m_pool.GetAndIncrementSequence());
14761485
}
14771486

1487+
if (!m_subpackage.m_replaced_transactions.empty()) {
1488+
LogPrint(BCLog::MEMPOOL, "replaced %u mempool transactions with 1 new transaction for %s additional fees, %d delta bytes\n",
1489+
m_subpackage.m_replaced_transactions.size(),
1490+
ws.m_modified_fees - m_subpackage.m_conflicting_fees,
1491+
ws.m_vsize - static_cast<int>(m_subpackage.m_conflicting_size));
1492+
}
1493+
14781494
return MempoolAcceptResult::Success(std::move(m_subpackage.m_replaced_transactions), ws.m_vsize, ws.m_base_fees,
14791495
effective_feerate, single_wtxid);
14801496
}

0 commit comments

Comments
 (0)