diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2231,11 +2231,8 @@ recentRejects->reset(); } - { - LOCK(g_cs_orphans); - if (mapOrphanTransactions.count(txid)) { - return true; - } + if (HaveOrphanTx(txid)) { + return true; } { diff --git a/src/txorphanage.h b/src/txorphanage.h --- a/src/txorphanage.h +++ b/src/txorphanage.h @@ -30,6 +30,7 @@ void AddChildrenToWorkSet(const CTransaction &tx, std::set &orphan_work_set) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans); +bool HaveOrphanTx(const TxId &txid) LOCKS_EXCLUDED(g_cs_orphans); /** * Map from txid to orphan transaction record. Limited by diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp --- a/src/txorphanage.cpp +++ b/src/txorphanage.cpp @@ -126,3 +126,8 @@ } } } + +bool HaveOrphanTx(const TxId &txid) { + LOCK(g_cs_orphans); + return mapOrphanTransactions.count(txid); +}