aboutsummaryrefslogtreecommitdiff
path: root/src/txorphanage.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2021-01-31 20:36:24 +1000
committerAnthony Towns <aj@erisian.com.au>2021-02-26 23:55:10 +1000
commitee135c8d5b39b0cb8b301a83e286285ab926dca7 (patch)
tree952f654c4767b501d734041c94b12a0f23e66502 /src/txorphanage.cpp
parent38a11c355acfc15134c682571b3d92f66b0e7c3c (diff)
downloadbitcoin-ee135c8d5b39b0cb8b301a83e286285ab926dca7.tar.xz
txorphanage: Extract AddChildrenToWorkSet
Extract some common code into AddChildrenToWorkSet function. (It's a hard knock life)
Diffstat (limited to 'src/txorphanage.cpp')
-rw-r--r--src/txorphanage.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index c883aaa57f..c1443115f0 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -106,3 +106,16 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
return nEvicted;
}
+void AddChildrenToWorkSet(const CTransaction& tx, std::set<uint256>& orphan_work_set)
+{
+ AssertLockHeld(g_cs_orphans);
+ for (unsigned int i = 0; i < tx.vout.size(); i++) {
+ const auto it_by_prev = mapOrphanTransactionsByPrev.find(COutPoint(tx.GetHash(), i));
+ if (it_by_prev != mapOrphanTransactionsByPrev.end()) {
+ for (const auto& elem : it_by_prev->second) {
+ orphan_work_set.insert(elem->first);
+ }
+ }
+ }
+}
+