[log] add category TXPACKAGES for orphanage and package relay

This commit is contained in:
glozow committed 2023-08-29 16:41:22 +01:00
1 parent a33dde1e41
commit 51b3275cd1
4 files changed
+13 -9

No files matched your search

+3
View File
@@ -182,6 +182,7 @@ const CLogCategoryDesc LogCategories[] =
{BCLog::BLOCKSTORAGE, "blockstorage"}, {BCLog::BLOCKSTORAGE, "blockstorage"},
{BCLog::TXRECONCILIATION, "txreconciliation"}, {BCLog::TXRECONCILIATION, "txreconciliation"},
{BCLog::SCAN, "scan"}, {BCLog::SCAN, "scan"},
{BCLog::TXPACKAGES, "txpackages"},
{BCLog::ALL, "1"}, {BCLog::ALL, "1"},
{BCLog::ALL, "all"}, {BCLog::ALL, "all"},
}; };
@@ -286,6 +287,8 @@ std::string LogCategoryToStr(BCLog::LogFlags category)
return "txreconciliation"; return "txreconciliation";
case BCLog::LogFlags::SCAN: case BCLog::LogFlags::SCAN:
return "scan"; return "scan";
case BCLog::LogFlags::TXPACKAGES:
return "txpackages";
case BCLog::LogFlags::ALL: case BCLog::LogFlags::ALL:
return "all"; return "all";
} }
+1
View File
@@ -68,6 +68,7 @@ namespace BCLog {
BLOCKSTORAGE = (1 << 26), BLOCKSTORAGE = (1 << 26),
TXRECONCILIATION = (1 << 27), TXRECONCILIATION = (1 << 27),
SCAN = (1 << 28), SCAN = (1 << 28),
TXPACKAGES = (1 << 29),
ALL = ~(uint32_t)0, ALL = ~(uint32_t)0,
}; };
enum class Level { enum class Level {
+3 -3
View File
@@ -2922,7 +2922,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
const uint256& orphan_wtxid = porphanTx->GetWitnessHash(); const uint256& orphan_wtxid = porphanTx->GetWitnessHash();
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) { if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString()); LogPrint(BCLog::TXPACKAGES, " accepted orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString());
RelayTransaction(orphanHash, porphanTx->GetWitnessHash()); RelayTransaction(orphanHash, porphanTx->GetWitnessHash());
m_orphanage.AddChildrenToWorkSet(*porphanTx); m_orphanage.AddChildrenToWorkSet(*porphanTx);
m_orphanage.EraseTx(orphanHash); m_orphanage.EraseTx(orphanHash);
@@ -2932,7 +2932,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
return true; return true;
} else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) { } else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
if (state.IsInvalid()) { if (state.IsInvalid()) {
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s (wtxid=%s) from peer=%d. %s\n", LogPrint(BCLog::TXPACKAGES, " invalid orphan tx %s (wtxid=%s) from peer=%d. %s\n",
orphanHash.ToString(), orphanHash.ToString(),
orphan_wtxid.ToString(), orphan_wtxid.ToString(),
peer.m_id, peer.m_id,
@@ -2942,7 +2942,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
} }
// Has inputs but not accepted to mempool // Has inputs but not accepted to mempool
// Probably non-standard or insufficient fee // Probably non-standard or insufficient fee
LogPrint(BCLog::MEMPOOL, " removed orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString()); LogPrint(BCLog::TXPACKAGES, " removed orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString());
if (state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) { if (state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) {
// We can add the wtxid of this transaction to our reject filter. // We can add the wtxid of this transaction to our reject filter.
// Do not add txids of witness transactions or witness-stripped // Do not add txids of witness transactions or witness-stripped
+6 -6
View File
@@ -35,7 +35,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
unsigned int sz = GetTransactionWeight(*tx); unsigned int sz = GetTransactionWeight(*tx);
if (sz > MAX_STANDARD_TX_WEIGHT) if (sz > MAX_STANDARD_TX_WEIGHT)
{ {
LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, txid: %s, wtxid: %s)\n", sz, hash.ToString(), wtxid.ToString()); LogPrint(BCLog::TXPACKAGES, "ignoring large orphan tx (size: %u, txid: %s, wtxid: %s)\n", sz, hash.ToString(), wtxid.ToString());
return false; return false;
} }
@@ -48,7 +48,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
m_outpoint_to_orphan_it[txin.prevout].insert(ret.first); m_outpoint_to_orphan_it[txin.prevout].insert(ret.first);
} }
LogPrint(BCLog::MEMPOOL, "stored orphan tx %s (wtxid=%s) (mapsz %u outsz %u)\n", hash.ToString(), wtxid.ToString(), LogPrint(BCLog::TXPACKAGES, "stored orphan tx %s (wtxid=%s) (mapsz %u outsz %u)\n", hash.ToString(), wtxid.ToString(),
m_orphans.size(), m_outpoint_to_orphan_it.size()); m_orphans.size(), m_outpoint_to_orphan_it.size());
return true; return true;
} }
@@ -107,7 +107,7 @@ void TxOrphanage::EraseForPeer(NodeId peer)
nErased += EraseTxNoLock(maybeErase->second.tx->GetHash()); nErased += EraseTxNoLock(maybeErase->second.tx->GetHash());
} }
} }
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer); if (nErased > 0) LogPrint(BCLog::TXPACKAGES, "Erased %d orphan tx from peer=%d\n", nErased, peer);
} }
void TxOrphanage::LimitOrphans(unsigned int max_orphans) void TxOrphanage::LimitOrphans(unsigned int max_orphans)
@@ -133,7 +133,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
} }
// Sweep again 5 minutes after the next entry that expires in order to batch the linear scan. // Sweep again 5 minutes after the next entry that expires in order to batch the linear scan.
nNextSweep = nMinExpTime + ORPHAN_TX_EXPIRE_INTERVAL; nNextSweep = nMinExpTime + ORPHAN_TX_EXPIRE_INTERVAL;
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx due to expiration\n", nErased); if (nErased > 0) LogPrint(BCLog::TXPACKAGES, "Erased %d orphan tx due to expiration\n", nErased);
} }
FastRandomContext rng; FastRandomContext rng;
while (m_orphans.size() > max_orphans) while (m_orphans.size() > max_orphans)
@@ -143,7 +143,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
EraseTxNoLock(m_orphan_list[randompos]->first); EraseTxNoLock(m_orphan_list[randompos]->first);
++nEvicted; ++nEvicted;
} }
if (nEvicted > 0) LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted); if (nEvicted > 0) LogPrint(BCLog::TXPACKAGES, "orphanage overflow, removed %u tx\n", nEvicted);
} }
void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx) void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx)
@@ -234,6 +234,6 @@ void TxOrphanage::EraseForBlock(const CBlock& block)
for (const uint256& orphanHash : vOrphanErase) { for (const uint256& orphanHash : vOrphanErase) {
nErased += EraseTxNoLock(orphanHash); nErased += EraseTxNoLock(orphanHash);
} }
LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx included or conflicted by block\n", nErased); LogPrint(BCLog::TXPACKAGES, "Erased %d orphan tx included or conflicted by block\n", nErased);
} }
} }