mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
fix up TxOrphanage lower_bound sanity checks
Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
This commit is contained in:
@@ -497,8 +497,8 @@ void TxOrphanageImpl::LimitOrphans()
|
|||||||
unsigned int num_erased_this_round{0};
|
unsigned int num_erased_this_round{0};
|
||||||
unsigned int starting_num_ann{it_worst_peer->second.m_count_announcements};
|
unsigned int starting_num_ann{it_worst_peer->second.m_count_announcements};
|
||||||
while (NeedsTrim()) {
|
while (NeedsTrim()) {
|
||||||
if (!Assume(it_ann->m_announcer == worst_peer)) break;
|
|
||||||
if (!Assume(it_ann != m_orphans.get<ByPeer>().end())) break;
|
if (!Assume(it_ann != m_orphans.get<ByPeer>().end())) break;
|
||||||
|
if (!Assume(it_ann->m_announcer == worst_peer)) break;
|
||||||
|
|
||||||
Erase<ByPeer>(it_ann++);
|
Erase<ByPeer>(it_ann++);
|
||||||
num_erased += 1;
|
num_erased += 1;
|
||||||
@@ -537,7 +537,7 @@ std::vector<std::pair<Wtxid, NodeId>> TxOrphanageImpl::AddChildrenToWorkSet(cons
|
|||||||
|
|
||||||
// Belt and suspenders, each entry in m_outpoint_to_orphan_wtxids should always have at least 1 announcement.
|
// Belt and suspenders, each entry in m_outpoint_to_orphan_wtxids should always have at least 1 announcement.
|
||||||
auto it = index_by_wtxid.lower_bound(ByWtxidView{wtxid, MIN_PEER});
|
auto it = index_by_wtxid.lower_bound(ByWtxidView{wtxid, MIN_PEER});
|
||||||
if (!Assume(it != index_by_wtxid.end())) continue;
|
if (!Assume(it != index_by_wtxid.end() && it->m_tx->GetWitnessHash() == wtxid)) continue;
|
||||||
|
|
||||||
// Select a random peer to assign orphan processing, reducing wasted work if the orphan is still missing
|
// Select a random peer to assign orphan processing, reducing wasted work if the orphan is still missing
|
||||||
// inputs. However, we don't want to create an issue in which the assigned peer can purposefully stop us
|
// inputs. However, we don't want to create an issue in which the assigned peer can purposefully stop us
|
||||||
|
|||||||
Reference in New Issue
Block a user