If there is a tx that can be reconsidered, return it and set it back to * non-reconsiderable. Otherwise, return a nullptr. */
| 590 | /** If there is a tx that can be reconsidered, return it and set it back to |
| 591 | * non-reconsiderable. Otherwise, return a nullptr. */ |
| 592 | CTransactionRef 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. */ |
| 609 | bool TxOrphanageImpl::HaveTxToReconsider(NodeId peer) |