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

@ -1929,6 +1929,7 @@ void PeerManagerImpl::StartScheduledTasks(CScheduler& scheduler)
* possibly reduce dynamic block stalling timeout.
*/
void PeerManagerImpl::BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
{
{
LOCK2(::cs_main, g_cs_orphans);
@ -1937,6 +1938,7 @@ void PeerManagerImpl::BlockConnected(const std::shared_ptr<const CBlock>& pblock
LogPrint(BCLog::MEMPOOL, "Trying to process %d orphans\n", orphanWorkSet.size());
ProcessOrphanTx(orphanWorkSet);
}
}
m_orphanage.EraseForBlock(*pblock);
m_last_tip_update = GetTime<std::chrono::seconds>();

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;