0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-22 12:23:34 -05:00

[refactor] rename to OrphanResolutionCandidate to MaybeAdd*

This commit is contained in:
glozow 2025-01-29 18:05:09 -05:00
parent 57221ad979
commit 6e4d392a75
2 changed files with 4 additions and 4 deletions

View file

@ -187,7 +187,7 @@ bool TxDownloadManagerImpl::AddTxAnnouncement(NodeId peer, const GenTxid& gtxid,
if (unique_parents.empty()) return true; if (unique_parents.empty()) return true;
if (OrphanResolutionCandidate(unique_parents, orphan_tx->GetWitnessHash(), peer, now)) { if (MaybeAddOrphanResolutionCandidate(unique_parents, orphan_tx->GetWitnessHash(), peer, now)) {
m_orphanage.AddAnnouncer(orphan_tx->GetWitnessHash(), peer); m_orphanage.AddAnnouncer(orphan_tx->GetWitnessHash(), peer);
} }
@ -224,7 +224,7 @@ bool TxDownloadManagerImpl::AddTxAnnouncement(NodeId peer, const GenTxid& gtxid,
return false; return false;
} }
bool TxDownloadManagerImpl::OrphanResolutionCandidate(const std::vector<Txid>& unique_parents, const Wtxid& wtxid, NodeId nodeid, std::chrono::microseconds now) bool TxDownloadManagerImpl::MaybeAddOrphanResolutionCandidate(const std::vector<Txid>& unique_parents, const Wtxid& wtxid, NodeId nodeid, std::chrono::microseconds now)
{ {
auto it_peer = m_peer_info.find(nodeid); auto it_peer = m_peer_info.find(nodeid);
if (it_peer == m_peer_info.end()) return false; if (it_peer == m_peer_info.end()) return false;
@ -402,7 +402,7 @@ node::RejectedTxTodo TxDownloadManagerImpl::MempoolRejectedTx(const CTransaction
add_extra_compact_tx &= !m_orphanage.HaveTx(wtxid); add_extra_compact_tx &= !m_orphanage.HaveTx(wtxid);
auto add_orphan_reso_candidate = [&](const CTransactionRef& orphan_tx, const std::vector<Txid>& unique_parents, NodeId nodeid, std::chrono::microseconds now) { auto add_orphan_reso_candidate = [&](const CTransactionRef& orphan_tx, const std::vector<Txid>& unique_parents, NodeId nodeid, std::chrono::microseconds now) {
if (OrphanResolutionCandidate(unique_parents, orphan_tx->GetWitnessHash(), nodeid, now)) { if (MaybeAddOrphanResolutionCandidate(unique_parents, orphan_tx->GetWitnessHash(), nodeid, now)) {
m_orphanage.AddTx(orphan_tx, nodeid); m_orphanage.AddTx(orphan_tx, nodeid);
} }
}; };

View file

@ -198,7 +198,7 @@ protected:
* this peer; add them as new invs to m_txrequest. * this peer; add them as new invs to m_txrequest.
* @returns whether this transaction was a valid orphan resolution candidate. * @returns whether this transaction was a valid orphan resolution candidate.
* */ * */
bool OrphanResolutionCandidate(const std::vector<Txid>& unique_parents, const Wtxid& wtxid, NodeId nodeid, std::chrono::microseconds now); bool MaybeAddOrphanResolutionCandidate(const std::vector<Txid>& unique_parents, const Wtxid& wtxid, NodeId nodeid, std::chrono::microseconds now);
}; };
} // namespace node } // namespace node
#endif // BITCOIN_NODE_TXDOWNLOADMAN_IMPL_H #endif // BITCOIN_NODE_TXDOWNLOADMAN_IMPL_H