mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
[log] add category TXPACKAGES for orphanage and package relay
This commit is contained in:
parent
a33dde1e41
commit
51b3275cd1
4 changed files with 13 additions and 9 deletions
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue