@@ -2919,9 +2919,15 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
2919
2919
const MempoolAcceptResult result = m_chainman.ProcessTransaction (porphanTx);
2920
2920
const TxValidationState& state = result.m_state ;
2921
2921
const uint256& orphanHash = porphanTx->GetHash ();
2922
+ const uint256& orphan_wtxid = porphanTx->GetWitnessHash ();
2922
2923
2923
2924
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
2924
- LogPrint (BCLog::MEMPOOL, " accepted orphan tx %s\n " , orphanHash.ToString ());
2925
+ LogPrint (BCLog::TXPACKAGES, " accepted orphan tx %s (wtxid=%s)\n " , orphanHash.ToString (), orphan_wtxid.ToString ());
2926
+ LogPrint (BCLog::MEMPOOL, " AcceptToMemoryPool: peer=%d: accepted %s (wtxid=%s) (poolsz %u txn, %u kB)\n " ,
2927
+ peer.m_id ,
2928
+ orphanHash.ToString (),
2929
+ orphan_wtxid.ToString (),
2930
+ m_mempool.size (), m_mempool.DynamicMemoryUsage () / 1000 );
2925
2931
RelayTransaction (orphanHash, porphanTx->GetWitnessHash ());
2926
2932
m_orphanage.AddChildrenToWorkSet (*porphanTx);
2927
2933
m_orphanage.EraseTx (orphanHash);
@@ -2931,16 +2937,22 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
2931
2937
return true ;
2932
2938
} else if (state.GetResult () != TxValidationResult::TX_MISSING_INPUTS) {
2933
2939
if (state.IsInvalid ()) {
2934
- LogPrint (BCLog::MEMPOOL , " invalid orphan tx %s from peer=%d. %s\n " ,
2940
+ LogPrint (BCLog::TXPACKAGES , " invalid orphan tx %s (wtxid=%s) from peer=%d. %s\n " ,
2935
2941
orphanHash.ToString (),
2942
+ orphan_wtxid.ToString (),
2943
+ peer.m_id ,
2944
+ state.ToString ());
2945
+ LogPrint (BCLog::MEMPOOLREJ, " %s (wtxid=%s) from peer=%d was not accepted: %s\n " ,
2946
+ orphanHash.ToString (),
2947
+ orphan_wtxid.ToString (),
2936
2948
peer.m_id ,
2937
2949
state.ToString ());
2938
2950
// Maybe punish peer that gave us an invalid orphan tx
2939
2951
MaybePunishNodeForTx (peer.m_id , state);
2940
2952
}
2941
2953
// Has inputs but not accepted to mempool
2942
2954
// Probably non-standard or insufficient fee
2943
- LogPrint (BCLog::MEMPOOL , " removed orphan tx %s\n " , orphanHash.ToString ());
2955
+ LogPrint (BCLog::TXPACKAGES , " removed orphan tx %s (wtxid=%s) \n " , orphanHash. ToString (), orphan_wtxid .ToString ());
2944
2956
if (state.GetResult () != TxValidationResult::TX_WITNESS_STRIPPED) {
2945
2957
// We can add the wtxid of this transaction to our reject filter.
2946
2958
// Do not add txids of witness transactions or witness-stripped
@@ -4115,12 +4127,29 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4115
4127
// permission, even if they were already in the mempool, allowing
4116
4128
// the node to function as a gateway for nodes hidden behind it.
4117
4129
if (!m_mempool.exists (GenTxid::Txid (tx.GetHash ()))) {
4118
- LogPrintf (" Not relaying non-mempool transaction %s from forcerelay peer=%d\n " , tx.GetHash ().ToString (), pfrom.GetId ());
4130
+ LogPrintf (" Not relaying non-mempool transaction %s (wtxid=%s) from forcerelay peer=%d\n " ,
4131
+ tx.GetHash ().ToString (), tx.GetWitnessHash ().ToString (), pfrom.GetId ());
4119
4132
} else {
4120
- LogPrintf (" Force relaying tx %s from peer=%d\n " , tx.GetHash ().ToString (), pfrom.GetId ());
4133
+ LogPrintf (" Force relaying tx %s (wtxid=%s) from peer=%d\n " ,
4134
+ tx.GetHash ().ToString (), tx.GetWitnessHash ().ToString (), pfrom.GetId ());
4121
4135
RelayTransaction (tx.GetHash (), tx.GetWitnessHash ());
4122
4136
}
4123
4137
}
4138
+ // If a tx is detected by m_recent_rejects it is ignored. Because we haven't
4139
+ // submitted the tx to our mempool, we won't have computed a DoS
4140
+ // score for it or determined exactly why we consider it invalid.
4141
+ //
4142
+ // This means we won't penalize any peer subsequently relaying a DoSy
4143
+ // tx (even if we penalized the first peer who gave it to us) because
4144
+ // we have to account for m_recent_rejects showing false positives. In
4145
+ // other words, we shouldn't penalize a peer if we aren't *sure* they
4146
+ // submitted a DoSy tx.
4147
+ //
4148
+ // Note that m_recent_rejects doesn't just record DoSy or invalid
4149
+ // transactions, but any tx not accepted by the mempool, which may be
4150
+ // due to node policy (vs. consensus). So we can't blanket penalize a
4151
+ // peer simply for relaying a tx that our m_recent_rejects has caught,
4152
+ // regardless of false positives.
4124
4153
return ;
4125
4154
}
4126
4155
@@ -4137,9 +4166,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4137
4166
4138
4167
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>();
4139
4168
4140
- LogPrint (BCLog::MEMPOOL, " AcceptToMemoryPool: peer=%d: accepted %s (poolsz %u txn, %u kB)\n " ,
4169
+ LogPrint (BCLog::MEMPOOL, " AcceptToMemoryPool: peer=%d: accepted %s (wtxid=%s) ( poolsz %u txn, %u kB)\n " ,
4141
4170
pfrom.GetId (),
4142
4171
tx.GetHash ().ToString (),
4172
+ tx.GetWitnessHash ().ToString (),
4143
4173
m_mempool.size (), m_mempool.DynamicMemoryUsage () / 1000 );
4144
4174
4145
4175
for (const CTransactionRef& removedTx : result.m_replaced_transactions .value ()) {
@@ -4191,7 +4221,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4191
4221
// DoS prevention: do not allow m_orphanage to grow unbounded (see CVE-2012-3789)
4192
4222
m_orphanage.LimitOrphans (m_opts.max_orphan_txs );
4193
4223
} else {
4194
- LogPrint (BCLog::MEMPOOL, " not keeping orphan with rejected parents %s\n " ,tx.GetHash ().ToString ());
4224
+ LogPrint (BCLog::MEMPOOL, " not keeping orphan with rejected parents %s (wtxid=%s)\n " ,
4225
+ tx.GetHash ().ToString (),
4226
+ tx.GetWitnessHash ().ToString ());
4195
4227
// We will continue to reject this tx since it has rejected
4196
4228
// parents so avoid re-requesting it from other peers.
4197
4229
// Here we add both the txid and the wtxid, as we know that
@@ -4238,25 +4270,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
4238
4270
}
4239
4271
}
4240
4272
4241
- // If a tx has been detected by m_recent_rejects, we will have reached
4242
- // this point and the tx will have been ignored. Because we haven't
4243
- // submitted the tx to our mempool, we won't have computed a DoS
4244
- // score for it or determined exactly why we consider it invalid.
4245
- //
4246
- // This means we won't penalize any peer subsequently relaying a DoSy
4247
- // tx (even if we penalized the first peer who gave it to us) because
4248
- // we have to account for m_recent_rejects showing false positives. In
4249
- // other words, we shouldn't penalize a peer if we aren't *sure* they
4250
- // submitted a DoSy tx.
4251
- //
4252
- // Note that m_recent_rejects doesn't just record DoSy or invalid
4253
- // transactions, but any tx not accepted by the mempool, which may be
4254
- // due to node policy (vs. consensus). So we can't blanket penalize a
4255
- // peer simply for relaying a tx that our m_recent_rejects has caught,
4256
- // regardless of false positives.
4257
-
4258
4273
if (state.IsInvalid ()) {
4259
- LogPrint (BCLog::MEMPOOLREJ, " %s from peer=%d was not accepted: %s\n " , tx.GetHash ().ToString (),
4274
+ LogPrint (BCLog::MEMPOOLREJ, " %s (wtxid=%s) from peer=%d was not accepted: %s\n " ,
4275
+ tx.GetHash ().ToString (),
4276
+ tx.GetWitnessHash ().ToString (),
4260
4277
pfrom.GetId (),
4261
4278
state.ToString ());
4262
4279
MaybePunishNodeForTx (pfrom.GetId (), state);
0 commit comments