@@ -50,17 +50,17 @@ class TxOrphanageImpl final : public TxOrphanage {
5050 { }
5151
5252 /* * Get an approximation for "memory usage". The total memory is a function of the memory used to store the
53- * transaction itself, each entry in m_orphans, and each entry in m_outpoint_to_orphan_it . We use weight because
53+ * transaction itself, each entry in m_orphans, and each entry in m_outpoint_to_orphan_wtxids . We use weight because
5454 * it is often higher than the actual memory usage of the tranaction. This metric conveniently encompasses
55- * m_outpoint_to_orphan_it usage since input data does not get the witness discount, and makes it easier to
55+ * m_outpoint_to_orphan_wtxids usage since input data does not get the witness discount, and makes it easier to
5656 * reason about each peer's limits using well-understood transaction attributes. */
5757 TxOrphanage::Usage GetMemUsage () const {
5858 return GetTransactionWeight (*m_tx);
5959 }
6060
6161 /* * Get an approximation of how much this transaction contributes to latency in EraseForBlock and EraseForPeer.
6262 * The computation time is a function of the number of entries in m_orphans (thus 1 per announcement) and the
63- * number of entries in m_outpoint_to_orphan_it (thus an additional 1 for every 10 inputs). Transactions with a
63+ * number of entries in m_outpoint_to_orphan_wtxids (thus an additional 1 for every 10 inputs). Transactions with a
6464 * small number of inputs (9 or fewer) are counted as 1 to make it easier to reason about each peer's limits in
6565 * terms of "normal" transactions. */
6666 TxOrphanage::Count GetLatencyScore () const {
@@ -117,7 +117,7 @@ class TxOrphanageImpl final : public TxOrphanage {
117117
118118 /* * Index from the parents' outputs to wtxids that exist in m_orphans. Used to find children of
119119 * a transaction that can be reconsidered and to remove entries that conflict with a block.*/
120- std::unordered_map<COutPoint, std::set<Wtxid>, SaltedOutpointHasher> m_outpoint_to_orphan_it ;
120+ std::unordered_map<COutPoint, std::set<Wtxid>, SaltedOutpointHasher> m_outpoint_to_orphan_wtxids ;
121121
122122 /* * Set of Wtxids for which (exactly) one announcement with m_reconsider=true exists. */
123123 std::set<Wtxid> m_reconsiderable_wtxids;
@@ -250,15 +250,15 @@ void TxOrphanageImpl::Erase(Iter<Tag> it)
250250 m_unique_rounded_input_scores -= it->GetLatencyScore () - 1 ;
251251 m_unique_orphan_usage -= it->GetMemUsage ();
252252
253- // Remove references in m_outpoint_to_orphan_it
253+ // Remove references in m_outpoint_to_orphan_wtxids
254254 const auto & wtxid{it->m_tx ->GetWitnessHash ()};
255255 for (const auto & input : it->m_tx ->vin ) {
256- auto it_prev = m_outpoint_to_orphan_it .find (input.prevout );
257- if (it_prev != m_outpoint_to_orphan_it .end ()) {
256+ auto it_prev = m_outpoint_to_orphan_wtxids .find (input.prevout );
257+ if (it_prev != m_outpoint_to_orphan_wtxids .end ()) {
258258 it_prev->second .erase (wtxid);
259259 // Clean up keys if they point to an empty set.
260260 if (it_prev->second .empty ()) {
261- m_outpoint_to_orphan_it .erase (it_prev);
261+ m_outpoint_to_orphan_wtxids .erase (it_prev);
262262 }
263263 }
264264 }
@@ -326,10 +326,10 @@ bool TxOrphanageImpl::AddTx(const CTransactionRef& tx, NodeId peer)
326326 auto & peer_info = m_peer_orphanage_info.try_emplace (peer).first ->second ;
327327 peer_info.Add (*iter);
328328
329- // Add links in m_outpoint_to_orphan_it
329+ // Add links in m_outpoint_to_orphan_wtxids
330330 if (brand_new) {
331331 for (const auto & input : tx->vin ) {
332- auto & wtxids_for_prevout = m_outpoint_to_orphan_it .try_emplace (input.prevout ).first ->second ;
332+ auto & wtxids_for_prevout = m_outpoint_to_orphan_wtxids .try_emplace (input.prevout ).first ->second ;
333333 wtxids_for_prevout.emplace (wtxid);
334334 }
335335
@@ -338,7 +338,7 @@ bool TxOrphanageImpl::AddTx(const CTransactionRef& tx, NodeId peer)
338338 m_unique_rounded_input_scores += iter->GetLatencyScore () - 1 ;
339339
340340 LogDebug (BCLog::TXPACKAGES, " stored orphan tx %s (wtxid=%s), weight: %u (mapsz %u outsz %u)\n " ,
341- txid.ToString (), wtxid.ToString (), sz, m_orphans.size (), m_outpoint_to_orphan_it .size ());
341+ txid.ToString (), wtxid.ToString (), sz, m_orphans.size (), m_outpoint_to_orphan_wtxids .size ());
342342 Assume (IsUnique (iter));
343343 } else {
344344 LogDebug (BCLog::TXPACKAGES, " added peer=%d as announcer of orphan tx %s (wtxid=%s)\n " ,
@@ -421,7 +421,7 @@ void TxOrphanageImpl::EraseForPeer(NodeId peer)
421421
422422 unsigned int num_ann{0 };
423423 while (it != index_by_peer.end () && it->m_announcer == peer) {
424- // Delete item, cleaning up m_outpoint_to_orphan_it iff this entry is unique by wtxid.
424+ // Delete item, cleaning up m_outpoint_to_orphan_wtxids iff this entry is unique by wtxid.
425425 Erase<ByPeer>(it++);
426426 num_ann += 1 ;
427427 }
@@ -529,13 +529,13 @@ std::vector<std::pair<Wtxid, NodeId>> TxOrphanageImpl::AddChildrenToWorkSet(cons
529529 std::vector<std::pair<Wtxid, NodeId>> ret;
530530 auto & index_by_wtxid = m_orphans.get <ByWtxid>();
531531 for (unsigned int i = 0 ; i < tx.vout .size (); i++) {
532- const auto it_by_prev = m_outpoint_to_orphan_it .find (COutPoint (tx.GetHash (), i));
533- if (it_by_prev != m_outpoint_to_orphan_it .end ()) {
532+ const auto it_by_prev = m_outpoint_to_orphan_wtxids .find (COutPoint (tx.GetHash (), i));
533+ if (it_by_prev != m_outpoint_to_orphan_wtxids .end ()) {
534534 for (const auto & wtxid : it_by_prev->second ) {
535535 // If a reconsiderable announcement for this wtxid already exists, skip it.
536536 if (m_reconsiderable_wtxids.contains (wtxid)) continue ;
537537
538- // Belt and suspenders, each entry in m_outpoint_to_orphan_it should always have at least 1 announcement.
538+ // Belt and suspenders, each entry in m_outpoint_to_orphan_wtxids should always have at least 1 announcement.
539539 auto it = index_by_wtxid.lower_bound (ByWtxidView{wtxid, MIN_PEER});
540540 if (!Assume (it != index_by_wtxid.end ())) continue ;
541541
@@ -615,8 +615,8 @@ void TxOrphanageImpl::EraseForBlock(const CBlock& block)
615615
616616 // Which orphan pool entries must we evict?
617617 for (const auto & input : block_tx.vin ) {
618- auto it_prev = m_outpoint_to_orphan_it .find (input.prevout );
619- if (it_prev != m_outpoint_to_orphan_it .end ()) {
618+ auto it_prev = m_outpoint_to_orphan_wtxids .find (input.prevout );
619+ if (it_prev != m_outpoint_to_orphan_wtxids .end ()) {
620620 // Copy all wtxids to wtxids_to_erase.
621621 std::copy (it_prev->second .cbegin (), it_prev->second .cend (), std::inserter (wtxids_to_erase, wtxids_to_erase.end ()));
622622 }
@@ -724,11 +724,11 @@ void TxOrphanageImpl::SanityCheck() const
724724 // Recalculated set of reconsiderable wtxids must match.
725725 assert (m_reconsiderable_wtxids == reconstructed_reconsiderable_wtxids);
726726
727- // All outpoints exist in m_outpoint_to_orphan_it , all keys in m_outpoint_to_orphan_it correspond to some
728- // orphan, and all wtxids referenced in m_outpoint_to_orphan_it are also in m_orphans.
729- // This ensures m_outpoint_to_orphan_it is cleaned up.
730- assert (all_outpoints.size () == m_outpoint_to_orphan_it .size ());
731- for (const auto & [outpoint, wtxid_set] : m_outpoint_to_orphan_it ) {
727+ // All outpoints exist in m_outpoint_to_orphan_wtxids , all keys in m_outpoint_to_orphan_wtxids correspond to some
728+ // orphan, and all wtxids referenced in m_outpoint_to_orphan_wtxids are also in m_orphans.
729+ // This ensures m_outpoint_to_orphan_wtxids is cleaned up.
730+ assert (all_outpoints.size () == m_outpoint_to_orphan_wtxids .size ());
731+ for (const auto & [outpoint, wtxid_set] : m_outpoint_to_orphan_wtxids ) {
732732 assert (all_outpoints.contains (outpoint));
733733 for (const auto & wtxid : wtxid_set) {
734734 assert (unique_wtxids_to_scores.contains (wtxid));
0 commit comments