mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
refactor: add OrphanTxBase for external use
Enables external entities to obtain orphan information
This commit is contained in:
parent
fc642c33ef
commit
91b65adff2
2 changed files with 7 additions and 3 deletions
|
@ -33,7 +33,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ret = m_orphans.emplace(wtxid, OrphanTx{tx, peer, Now<NodeSeconds>() + ORPHAN_TX_EXPIRE_TIME, m_orphan_list.size()});
|
auto ret = m_orphans.emplace(wtxid, OrphanTx{{tx, peer, Now<NodeSeconds>() + ORPHAN_TX_EXPIRE_TIME}, m_orphan_list.size()});
|
||||||
assert(ret.second);
|
assert(ret.second);
|
||||||
m_orphan_list.push_back(ret.first);
|
m_orphan_list.push_back(ret.first);
|
||||||
for (const CTxIn& txin : tx->vin) {
|
for (const CTxIn& txin : tx->vin) {
|
||||||
|
|
|
@ -72,11 +72,15 @@ public:
|
||||||
return m_orphans.size();
|
return m_orphans.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
/** Allows providing orphan information externally */
|
||||||
struct OrphanTx {
|
struct OrphanTxBase {
|
||||||
CTransactionRef tx;
|
CTransactionRef tx;
|
||||||
NodeId fromPeer;
|
NodeId fromPeer;
|
||||||
NodeSeconds nTimeExpire;
|
NodeSeconds nTimeExpire;
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
struct OrphanTx : public OrphanTxBase {
|
||||||
size_t list_pos;
|
size_t list_pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue