diff options
author | Anthony Towns <aj@erisian.com.au> | 2021-02-27 00:30:08 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2021-02-27 00:30:11 +1000 |
commit | 3c4c3c2fdda3a361e3802e97bc3566f815b75de1 (patch) | |
tree | d601baec217dbe5f4189df493cfeca600123cbe0 /src/net_processing.cpp | |
parent | 26d1a6ccd5fcc7abec737c0d8c67238561627d59 (diff) |
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.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 89586beba5..67a0c0e3d2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1096,17 +1096,6 @@ static void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_L vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % max_extra_txn; } -bool AddOrphanTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans) -{ - if (!OrphanageAddTx(tx, peer)) { - return false; - } - - AddToCompactExtraTransactions(tx); - - return true; -} - void PeerManagerImpl::Misbehaving(const NodeId pnode, const int howmuch, const std::string& message) { assert(howmuch > 0); @@ -3156,7 +3145,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, pfrom.AddKnownTx(parent_txid); if (!AlreadyHaveTx(gtxid)) AddTxAnnouncement(pfrom, gtxid, current_time); } - AddOrphanTx(ptx, pfrom.GetId()); + + if (OrphanageAddTx(ptx, pfrom.GetId())) { + AddToCompactExtraTransactions(ptx); + } // Once added to the orphan pool, a tx is considered AlreadyHave, and we shouldn't request it anymore. m_txrequest.ForgetTxHash(tx.GetHash()); |