aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-03-06 16:46:18 +0000
committerglozow <gloriajzhao@gmail.com>2023-08-29 16:41:22 +0100
commit51b3275cd1de467933f13d8b71286bf5ebd12b4b (patch)
tree94785b1417ebf58f7c622c5b390234836cb72f80
parenta33dde1e41d8923a46db84b50550175fa6149c48 (diff)
downloadbitcoin-51b3275cd1de467933f13d8b71286bf5ebd12b4b.tar.xz
[log] add category TXPACKAGES for orphanage and package relay
-rw-r--r--src/logging.cpp3
-rw-r--r--src/logging.h1
-rw-r--r--src/net_processing.cpp6
-rw-r--r--src/txorphanage.cpp12
4 files changed, 13 insertions, 9 deletions
diff --git a/src/logging.cpp b/src/logging.cpp
index a5cfb0d28e..08bfa1f7a4 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -182,6 +182,7 @@ const CLogCategoryDesc LogCategories[] =
{BCLog::BLOCKSTORAGE, "blockstorage"},
{BCLog::TXRECONCILIATION, "txreconciliation"},
{BCLog::SCAN, "scan"},
+ {BCLog::TXPACKAGES, "txpackages"},
{BCLog::ALL, "1"},
{BCLog::ALL, "all"},
};
@@ -286,6 +287,8 @@ std::string LogCategoryToStr(BCLog::LogFlags category)
return "txreconciliation";
case BCLog::LogFlags::SCAN:
return "scan";
+ case BCLog::LogFlags::TXPACKAGES:
+ return "txpackages";
case BCLog::LogFlags::ALL:
return "all";
}
diff --git a/src/logging.h b/src/logging.h
index fc03c8eac3..f7380d8928 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -68,6 +68,7 @@ namespace BCLog {
BLOCKSTORAGE = (1 << 26),
TXRECONCILIATION = (1 << 27),
SCAN = (1 << 28),
+ TXPACKAGES = (1 << 29),
ALL = ~(uint32_t)0,
};
enum class Level {
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 64103b2880..a0946754a0 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2922,7 +2922,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
const uint256& orphan_wtxid = porphanTx->GetWitnessHash();
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());
m_orphanage.AddChildrenToWorkSet(*porphanTx);
m_orphanage.EraseTx(orphanHash);
@@ -2932,7 +2932,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
return true;
} else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
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(),
orphan_wtxid.ToString(),
peer.m_id,
@@ -2942,7 +2942,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
}
// Has inputs but not accepted to mempool
// 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) {
// We can add the wtxid of this transaction to our reject filter.
// Do not add txids of witness transactions or witness-stripped
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index de84ca5956..4fed6a60ed 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -35,7 +35,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
unsigned int sz = GetTransactionWeight(*tx);
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;
}
@@ -48,7 +48,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
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());
return true;
}
@@ -107,7 +107,7 @@ void TxOrphanage::EraseForPeer(NodeId peer)
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)
@@ -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.
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;
while (m_orphans.size() > max_orphans)
@@ -143,7 +143,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
EraseTxNoLock(m_orphan_list[randompos]->first);
++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)
@@ -234,6 +234,6 @@ void TxOrphanage::EraseForBlock(const CBlock& block)
for (const uint256& orphanHash : vOrphanErase) {
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);
}
}