Skip to content

Commit fa9f20b

Browse files
author
MarcoFalke
committed
log: Properly log txs rejected from mempool
1 parent 5a454d7 commit fa9f20b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/net_processing.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,10 @@ void static ProcessOrphanTx(CConnman* connman, CTxMemPool& mempool, std::set<uin
19541954
if (MaybePunishNodeForTx(fromPeer, orphan_state)) {
19551955
setMisbehaving.insert(fromPeer);
19561956
}
1957-
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s\n", orphanHash.ToString());
1957+
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
1958+
orphanHash.ToString(),
1959+
fromPeer,
1960+
orphan_state.ToString());
19581961
}
19591962
// Has inputs but not accepted to mempool
19601963
// Probably non-standard or insufficient fee
@@ -2801,8 +2804,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
28012804
// peer simply for relaying a tx that our recentRejects has caught,
28022805
// regardless of false positives.
28032806

2804-
if (state.IsInvalid())
2805-
{
2807+
if (state.IsInvalid()) {
28062808
LogPrint(BCLog::MEMPOOLREJ, "%s from peer=%d was not accepted: %s\n", tx.GetHash().ToString(),
28072809
pfrom->GetId(),
28082810
state.ToString());

src/validation.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,9 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
569569
CAmount& nConflictingFees = ws.m_conflicting_fees;
570570
size_t& nConflictingSize = ws.m_conflicting_size;
571571

572-
if (!CheckTransaction(tx, state))
572+
if (!CheckTransaction(tx, state)) {
573573
return false; // state filled in by CheckTransaction
574+
}
574575

575576
// Coinbase is only valid in a block, not as a loose transaction
576577
if (tx.IsCoinBase())
@@ -680,7 +681,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
680681

681682
CAmount nFees = 0;
682683
if (!Consensus::CheckTxInputs(tx, state, m_view, GetSpendHeight(m_view), nFees)) {
683-
return error("%s: Consensus::CheckTxInputs: %s, %s", __func__, tx.GetHash().ToString(), state.ToString());
684+
return false; // state filled in by CheckTxInputs
684685
}
685686

686687
// Check for non-standard pay-to-script-hash in inputs

0 commit comments

Comments
 (0)