fix lock up I think

This commit is contained in:
blackjok3r
2018-12-14 23:40:51 +08:00
parent 1325c90a5b
commit e2bec5a99b

View File

@@ -4773,20 +4773,26 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
{ {
numiters++; numiters++;
numadded = 0; numadded = 0;
list<CTransaction> ToRemove;
BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx) BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx)
{ {
CTransaction tx = e.GetTx(); CTransaction tx = e.GetTx();
if (AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees) == true ) if (AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees) == true )
{ {
numadded++; numadded++;
tmpmempool.remove(tx, removed, false); ToRemove.push_back(tx);
} }
} }
BOOST_FOREACH(const CTransaction& tx, ToRemove)
{
tmpmempool.remove(tx, removed, false);
}
ToRemove.clear();
if ( numadded == 0 ) if ( numadded == 0 )
break; break;
} }
if ( 0 && numadded > 0 ) //if ( 0 && numadded > 0 )
fprintf(stderr, "CC mempool add: numiters.%d numadded.%d remains.%d\n",numiters,numadded,(int32_t)tmpmempool.size()); fprintf(stderr, "CC mempool add: numiters.%d remains.%d\n",numiters,(int32_t)tmpmempool.size());
// empty the temp mempool for next time. // empty the temp mempool for next time.
tmpmempool.clear(); tmpmempool.clear();
} }