[prep] change return type of EraseTx to bool

This function only ever returns 0 or 1 (number of unique orphans
erased).
This commit is contained in:
glozow
2025-06-09 16:01:15 -04:00
parent 3da6d7f8f6
commit b50bd72c42
3 changed files with 8 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ public:
bool HaveTx(const Wtxid& wtxid) const override;
bool HaveTxFromPeer(const Wtxid& wtxid, NodeId peer) const override;
CTransactionRef GetTxToReconsider(NodeId peer) override;
int EraseTx(const Wtxid& wtxid) override;
bool EraseTx(const Wtxid& wtxid) override;
void EraseForPeer(NodeId peer) override;
void EraseForBlock(const CBlock& block) override;
void LimitOrphans(FastRandomContext& rng) override;
@@ -147,11 +147,11 @@ bool TxOrphanageImpl::AddAnnouncer(const Wtxid& wtxid, NodeId peer)
return false;
}
int TxOrphanageImpl::EraseTx(const Wtxid& wtxid)
bool TxOrphanageImpl::EraseTx(const Wtxid& wtxid)
{
std::map<Wtxid, OrphanTx>::iterator it = m_orphans.find(wtxid);
if (it == m_orphans.end())
return 0;
return false;
for (const CTxIn& txin : it->second.tx->vin)
{
auto itPrev = m_outpoint_to_orphan_it.find(txin.prevout);
@@ -190,7 +190,7 @@ int TxOrphanageImpl::EraseTx(const Wtxid& wtxid)
m_orphan_list.pop_back();
m_orphans.erase(it);
return 1;
return true;
}
void TxOrphanageImpl::EraseForPeer(NodeId peer)