Skip to content

Commit 3c4c3c2

Browse files
committed
net_processing: drop AddOrphanTx
All the interesting functionality of AddOrphanTx is already in other functions, so call those functions directly in the one place that AddOrphanTx was used.
1 parent 26d1a6c commit 3c4c3c2

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/net_processing.cpp

+4-12
Original file line numberDiff line numberDiff line change
@@ -1096,17 +1096,6 @@ static void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_L
10961096
vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % max_extra_txn;
10971097
}
10981098

1099-
bool AddOrphanTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
1100-
{
1101-
if (!OrphanageAddTx(tx, peer)) {
1102-
return false;
1103-
}
1104-
1105-
AddToCompactExtraTransactions(tx);
1106-
1107-
return true;
1108-
}
1109-
11101099
void PeerManagerImpl::Misbehaving(const NodeId pnode, const int howmuch, const std::string& message)
11111100
{
11121101
assert(howmuch > 0);
@@ -3156,7 +3145,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
31563145
pfrom.AddKnownTx(parent_txid);
31573146
if (!AlreadyHaveTx(gtxid)) AddTxAnnouncement(pfrom, gtxid, current_time);
31583147
}
3159-
AddOrphanTx(ptx, pfrom.GetId());
3148+
3149+
if (OrphanageAddTx(ptx, pfrom.GetId())) {
3150+
AddToCompactExtraTransactions(ptx);
3151+
}
31603152

31613153
// Once added to the orphan pool, a tx is considered AlreadyHave, and we shouldn't request it anymore.
31623154
m_txrequest.ForgetTxHash(tx.GetHash());

0 commit comments

Comments
 (0)