mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-19 19:29:45 +02:00
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().
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user