Skip to content

Commit 51b3275

Browse files
committed
[log] add category TXPACKAGES for orphanage and package relay
1 parent a33dde1 commit 51b3275

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/logging.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ const CLogCategoryDesc LogCategories[] =
182182
{BCLog::BLOCKSTORAGE, "blockstorage"},
183183
{BCLog::TXRECONCILIATION, "txreconciliation"},
184184
{BCLog::SCAN, "scan"},
185+
{BCLog::TXPACKAGES, "txpackages"},
185186
{BCLog::ALL, "1"},
186187
{BCLog::ALL, "all"},
187188
};
@@ -286,6 +287,8 @@ std::string LogCategoryToStr(BCLog::LogFlags category)
286287
return "txreconciliation";
287288
case BCLog::LogFlags::SCAN:
288289
return "scan";
290+
case BCLog::LogFlags::TXPACKAGES:
291+
return "txpackages";
289292
case BCLog::LogFlags::ALL:
290293
return "all";
291294
}

src/logging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ namespace BCLog {
6868
BLOCKSTORAGE = (1 << 26),
6969
TXRECONCILIATION = (1 << 27),
7070
SCAN = (1 << 28),
71+
TXPACKAGES = (1 << 29),
7172
ALL = ~(uint32_t)0,
7273
};
7374
enum class Level {

src/net_processing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
29222922
const uint256& orphan_wtxid = porphanTx->GetWitnessHash();
29232923

29242924
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
2925-
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString());
2925+
LogPrint(BCLog::TXPACKAGES, " accepted orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString());
29262926
RelayTransaction(orphanHash, porphanTx->GetWitnessHash());
29272927
m_orphanage.AddChildrenToWorkSet(*porphanTx);
29282928
m_orphanage.EraseTx(orphanHash);
@@ -2932,7 +2932,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
29322932
return true;
29332933
} else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
29342934
if (state.IsInvalid()) {
2935-
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s (wtxid=%s) from peer=%d. %s\n",
2935+
LogPrint(BCLog::TXPACKAGES, " invalid orphan tx %s (wtxid=%s) from peer=%d. %s\n",
29362936
orphanHash.ToString(),
29372937
orphan_wtxid.ToString(),
29382938
peer.m_id,
@@ -2942,7 +2942,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
29422942
}
29432943
// Has inputs but not accepted to mempool
29442944
// Probably non-standard or insufficient fee
2945-
LogPrint(BCLog::MEMPOOL, " removed orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString());
2945+
LogPrint(BCLog::TXPACKAGES, " removed orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString());
29462946
if (state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) {
29472947
// We can add the wtxid of this transaction to our reject filter.
29482948
// Do not add txids of witness transactions or witness-stripped

src/txorphanage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
3535
unsigned int sz = GetTransactionWeight(*tx);
3636
if (sz > MAX_STANDARD_TX_WEIGHT)
3737
{
38-
LogPrint(BCLog::MEMPOOL, "ignoring large orphan tx (size: %u, txid: %s, wtxid: %s)\n", sz, hash.ToString(), wtxid.ToString());
38+
LogPrint(BCLog::TXPACKAGES, "ignoring large orphan tx (size: %u, txid: %s, wtxid: %s)\n", sz, hash.ToString(), wtxid.ToString());
3939
return false;
4040
}
4141

@@ -48,7 +48,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
4848
m_outpoint_to_orphan_it[txin.prevout].insert(ret.first);
4949
}
5050

51-
LogPrint(BCLog::MEMPOOL, "stored orphan tx %s (wtxid=%s) (mapsz %u outsz %u)\n", hash.ToString(), wtxid.ToString(),
51+
LogPrint(BCLog::TXPACKAGES, "stored orphan tx %s (wtxid=%s) (mapsz %u outsz %u)\n", hash.ToString(), wtxid.ToString(),
5252
m_orphans.size(), m_outpoint_to_orphan_it.size());
5353
return true;
5454
}
@@ -107,7 +107,7 @@ void TxOrphanage::EraseForPeer(NodeId peer)
107107
nErased += EraseTxNoLock(maybeErase->second.tx->GetHash());
108108
}
109109
}
110-
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer);
110+
if (nErased > 0) LogPrint(BCLog::TXPACKAGES, "Erased %d orphan tx from peer=%d\n", nErased, peer);
111111
}
112112

113113
void TxOrphanage::LimitOrphans(unsigned int max_orphans)
@@ -133,7 +133,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
133133
}
134134
// Sweep again 5 minutes after the next entry that expires in order to batch the linear scan.
135135
nNextSweep = nMinExpTime + ORPHAN_TX_EXPIRE_INTERVAL;
136-
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx due to expiration\n", nErased);
136+
if (nErased > 0) LogPrint(BCLog::TXPACKAGES, "Erased %d orphan tx due to expiration\n", nErased);
137137
}
138138
FastRandomContext rng;
139139
while (m_orphans.size() > max_orphans)
@@ -143,7 +143,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
143143
EraseTxNoLock(m_orphan_list[randompos]->first);
144144
++nEvicted;
145145
}
146-
if (nEvicted > 0) LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted);
146+
if (nEvicted > 0) LogPrint(BCLog::TXPACKAGES, "orphanage overflow, removed %u tx\n", nEvicted);
147147
}
148148

149149
void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx)
@@ -234,6 +234,6 @@ void TxOrphanage::EraseForBlock(const CBlock& block)
234234
for (const uint256& orphanHash : vOrphanErase) {
235235
nErased += EraseTxNoLock(orphanHash);
236236
}
237-
LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx included or conflicted by block\n", nErased);
237+
LogPrint(BCLog::TXPACKAGES, "Erased %d orphan tx included or conflicted by block\n", nErased);
238238
}
239239
}

0 commit comments

Comments
 (0)