Skip to content

Commit b10c55b

Browse files
glozowtheStack
andcommitted
fix up TxOrphanage lower_bound sanity checks
Co-authored-by: Sebastian Falbesoner <[email protected]>
1 parent cfd71c6 commit b10c55b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node/txorphanage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ void TxOrphanageImpl::LimitOrphans()
497497
unsigned int num_erased_this_round{0};
498498
unsigned int starting_num_ann{it_worst_peer->second.m_count_announcements};
499499
while (NeedsTrim()) {
500-
if (!Assume(it_ann->m_announcer == worst_peer)) break;
501500
if (!Assume(it_ann != m_orphans.get<ByPeer>().end())) break;
501+
if (!Assume(it_ann->m_announcer == worst_peer)) break;
502502

503503
Erase<ByPeer>(it_ann++);
504504
num_erased += 1;
@@ -537,7 +537,7 @@ std::vector<std::pair<Wtxid, NodeId>> TxOrphanageImpl::AddChildrenToWorkSet(cons
537537

538538
// 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});
540-
if (!Assume(it != index_by_wtxid.end())) continue;
540+
if (!Assume(it != index_by_wtxid.end() && it->m_tx->GetWitnessHash() == wtxid)) continue;
541541

542542
// Select a random peer to assign orphan processing, reducing wasted work if the orphan is still missing
543543
// inputs. However, we don't want to create an issue in which the assigned peer can purposefully stop us

0 commit comments

Comments
 (0)