txorphanage: Extract GetOrphanTx

Extract orphan lookup code into GetOrphanTx function.
This commit is contained in:
Anthony Towns
2021-01-31 21:59:57 +10:00
parent 83679ffc60
commit f294da7274
3 changed files with 13 additions and 5 deletions

View File

@@ -129,3 +129,11 @@ bool HaveOrphanTx(const GenTxid& gtxid)
}
}
std::pair<CTransactionRef, NodeId> GetOrphanTx(const uint256& txid)
{
AssertLockHeld(g_cs_orphans);
const auto it = mapOrphanTransactions.find(txid);
if (it == mapOrphanTransactions.end()) return {nullptr, -1};
return {it->second.tx, it->second.fromPeer};
}