fix: fixes for orphange's locks and cs_main

This commit is contained in:
Konstantin Akimov 2024-10-07 00:35:30 +07:00
parent 002580c42d
commit 846ebab6e0
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
2 changed files with 8 additions and 6 deletions

View File

@ -1930,12 +1930,14 @@ void PeerManagerImpl::StartScheduledTasks(CScheduler& scheduler)
*/
void PeerManagerImpl::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
{
LOCK2(::cs_main, g_cs_orphans);
{
LOCK2(::cs_main, g_cs_orphans);
auto orphanWorkSet = m_orphanage.GetCandidatesForBlock(*pblock);
while (!orphanWorkSet.empty()) {
LogPrint(BCLog::MEMPOOL, "Trying to process %d orphans\n", orphanWorkSet.size());
ProcessOrphanTx(orphanWorkSet);
auto orphanWorkSet = m_orphanage.GetCandidatesForBlock(*pblock);
while (!orphanWorkSet.empty()) {
LogPrint(BCLog::MEMPOOL, "Trying to process %d orphans\n", orphanWorkSet.size());
ProcessOrphanTx(orphanWorkSet);
}
}
m_orphanage.EraseForBlock(*pblock);

View File

@ -197,7 +197,7 @@ std::set<uint256> TxOrphanage::GetCandidatesForBlock(const CBlock& block)
void TxOrphanage::EraseForBlock(const CBlock& block)
{
AssertLockHeld(g_cs_orphans);
LOCK(g_cs_orphans);
std::vector<uint256> vOrphanErase;