From 91b65adff2aaf16f42c5ccca6e16b951e0e84f9a Mon Sep 17 00:00:00 2001 From: tdb3 <106488469+tdb3@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:40:52 -0400 Subject: [PATCH] refactor: add OrphanTxBase for external use Enables external entities to obtain orphan information --- src/txorphanage.cpp | 2 +- src/txorphanage.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp index 35a215c88a4..35cf26a7be1 100644 --- a/src/txorphanage.cpp +++ b/src/txorphanage.cpp @@ -33,7 +33,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer) return false; } - auto ret = m_orphans.emplace(wtxid, OrphanTx{tx, peer, Now() + ORPHAN_TX_EXPIRE_TIME, m_orphan_list.size()}); + auto ret = m_orphans.emplace(wtxid, OrphanTx{{tx, peer, Now() + ORPHAN_TX_EXPIRE_TIME}, m_orphan_list.size()}); assert(ret.second); m_orphan_list.push_back(ret.first); for (const CTxIn& txin : tx->vin) { diff --git a/src/txorphanage.h b/src/txorphanage.h index 2c53d1d40f6..5123bfe8678 100644 --- a/src/txorphanage.h +++ b/src/txorphanage.h @@ -72,11 +72,15 @@ public: return m_orphans.size(); } -protected: - struct OrphanTx { + /** Allows providing orphan information externally */ + struct OrphanTxBase { CTransactionRef tx; NodeId fromPeer; NodeSeconds nTimeExpire; + }; + +protected: + struct OrphanTx : public OrphanTxBase { size_t list_pos; };