aboutsummaryrefslogtreecommitdiff
path: root/src/txorphanage.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2022-12-23 00:21:10 +1000
committerAnthony Towns <aj@erisian.com.au>2023-01-25 18:15:26 +1000
commitc58c249a5b694c88122589fedbef4e2f13f08bb4 (patch)
treea25ac7c1abc43b5c49f3f50a16920a7dff174483 /src/txorphanage.cpp
parentecb0a3e4259b81d6bb74d59a58eb65552c17d8d8 (diff)
downloadbitcoin-c58c249a5b694c88122589fedbef4e2f13f08bb4.tar.xz
net_processing: indicate more work to do when orphans are ready to reconsider
When PR#15644 made orphan processing interruptible, it also introduced a potential 100ms delay between processing of the first and second newly reconsiderable orphan, because it didn't check if the orphan work set was non-empty after invoking ProcessMessage(). This adds that check, so that ProcessMessages() will return true if there are orphans to process, usually avoiding the 100ms delay in CConnman::ThreadMessageHandler().
Diffstat (limited to 'src/txorphanage.cpp')
-rw-r--r--src/txorphanage.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index f82cd886f9..eb74d3451e 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -194,6 +194,18 @@ CTransactionRef TxOrphanage::GetTxToReconsider(NodeId peer)
return nullptr;
}
+bool TxOrphanage::HaveTxToReconsider(NodeId peer)
+{
+ LOCK(m_mutex);
+
+ auto work_set_it = m_peer_work_set.find(peer);
+ if (work_set_it != m_peer_work_set.end()) {
+ auto& work_set = work_set_it->second;
+ return !work_set.empty();
+ }
+ return false;
+}
+
void TxOrphanage::EraseForBlock(const CBlock& block)
{
LOCK(m_mutex);