Skip to content

Commit be23046

Browse files
committed
txorphange: Drop redundant originator arg from GetTxToReconsider
1 parent a4fe099 commit be23046

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/net_processing.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,10 +2892,9 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
28922892
AssertLockHeld(cs_main);
28932893

28942894
CTransactionRef porphanTx = nullptr;
2895-
NodeId from_peer = -1;
28962895
bool more = false;
28972896

2898-
while (CTransactionRef porphanTx = m_orphanage.GetTxToReconsider(peer.m_id, from_peer, more)) {
2897+
while (CTransactionRef porphanTx = m_orphanage.GetTxToReconsider(peer.m_id, more)) {
28992898
const MempoolAcceptResult result = m_chainman.ProcessTransaction(porphanTx);
29002899
const TxValidationState& state = result.m_state;
29012900
const uint256& orphanHash = porphanTx->GetHash();
@@ -2913,10 +2912,10 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer)
29132912
if (state.IsInvalid()) {
29142913
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
29152914
orphanHash.ToString(),
2916-
from_peer,
2915+
peer.m_id,
29172916
state.ToString());
29182917
// Maybe punish peer that gave us an invalid orphan tx
2919-
MaybePunishNodeForTx(from_peer, state);
2918+
MaybePunishNodeForTx(peer.m_id, state);
29202919
}
29212920
// Has inputs but not accepted to mempool
29222921
// Probably non-standard or insufficient fee

src/test/fuzz/txorphan.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ FUZZ_TARGET_INIT(txorphan, initialize_orphanage)
8989
},
9090
[&] {
9191
{
92-
NodeId originator;
9392
bool more = true;
94-
CTransactionRef ref = orphanage.GetTxToReconsider(peer_id, originator, more);
93+
CTransactionRef ref = orphanage.GetTxToReconsider(peer_id, more);
9594
if (!ref) {
9695
Assert(!more);
9796
} else {

src/txorphanage.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ bool TxOrphanage::HaveTx(const GenTxid& gtxid) const
174174
}
175175
}
176176

177-
CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer, NodeId& originator, bool& more)
177+
CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer, bool& more)
178178
{
179179
LOCK(m_mutex);
180180

@@ -188,7 +188,6 @@ CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer, NodeId& originator,
188188
const auto orphan_it = m_orphans.find(txid);
189189
if (orphan_it != m_orphans.end()) {
190190
more = !work_set.empty();
191-
originator = orphan_it->second.fromPeer;
192191
return orphan_it->second.tx;
193192
}
194193
}

src/txorphanage.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class TxOrphanage {
2929
/** Extract a transaction from a peer's work set
3030
* Returns nullptr and sets more to false if there are no transactions
3131
* to work on. Otherwise returns the transaction reference, removes
32-
* the transaction from the work set, and populates its arguments with
33-
* the originating peer, and whether there are more orphans for this peer
32+
* the transaction from the work set, and sets "more" to indicate
33+
* if there are more orphans for this peer
3434
* to work on after this tx.
3535
*/
36-
CTransactionRef GetTxToReconsider(NodeId peer, NodeId& originator, bool& more) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);
36+
CTransactionRef GetTxToReconsider(NodeId peer, bool& more) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);
3737

3838
/** Erase an orphan by txid */
3939
int EraseTx(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);

0 commit comments

Comments
 (0)