MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GetTxToReconsider

Method GetTxToReconsider

src/node/txorphanage.cpp:592–606  ·  view source on GitHub ↗

If there is a tx that can be reconsidered, return it and set it back to * non-reconsiderable. Otherwise, return a nullptr. */

Source from the content-addressed store, hash-verified

590/** If there is a tx that can be reconsidered, return it and set it back to
591 * non-reconsiderable. Otherwise, return a nullptr. */
592CTransactionRef TxOrphanageImpl::GetTxToReconsider(NodeId peer)
593{
594 auto it = m_orphans.get<ByPeer>().lower_bound(ByPeerView{peer, true, 0});
595 if (it != m_orphans.get<ByPeer>().end() && it->m_announcer == peer && it->m_reconsider) {
596 // Flip m_reconsider. Even if this transaction stays in orphanage, it shouldn't be
597 // reconsidered again until there is a new reason to do so.
598 static constexpr auto mark_reconsidered_modifier = [](auto& ann) { ann.m_reconsider = false; };
599 m_orphans.get<ByPeer>().modify(it, mark_reconsidered_modifier);
600 // As there is exactly one m_reconsider announcement per reconsiderable wtxids, flipping
601 // the m_reconsider flag means the wtxid is no longer reconsiderable.
602 m_reconsiderable_wtxids.erase(it->m_tx->GetWitnessHash());
603 return it->m_tx;
604 }
605 return nullptr;
606}
607
608/** Return whether there is a tx that can be reconsidered. */
609bool TxOrphanageImpl::HaveTxToReconsider(NodeId peer)

Callers 5

ProcessOrphanTxMethod · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
txdownloadman.cppFile · 0.45
txorphan.cppFile · 0.45
FUZZ_TARGETFunction · 0.45

Calls 3

lower_boundMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.36
FUZZ_TARGETFunction · 0.36