diff --git a/src/main.cpp b/src/main.cpp index a8e523c1f..a2314f644 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4680,7 +4680,8 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C int32_t i,j,rejects=0,lastrejects=0; //fprintf(stderr,"put block's tx into mempool\n"); // Copy all non Z-txs in mempool to temporary mempool because there can be tx in local mempool that make the block invalid. - LOCK(mempool.cs); + LOCK2(cs_main,mempool.cs); + //fprintf(stderr, "starting... mempoolsize.%ld\n",mempool.size()); list transactionsToRemove; BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) { const CTransaction &tx = e.GetTx(); @@ -4698,6 +4699,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C // CC validation shouldnt (cant) depend on the state of mempool! while ( 1 ) { + list removed; for (i=0; i removed; - LOCK(mempool.cs); - while ( 1 ) + BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx) { - numiters++; - numadded = 0; - list ToRemove; - BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx) - { - CTransaction tx = e.GetTx(); - if (AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees) == true ) - { - numadded++; - ToRemove.push_back(tx); - } + const CTransaction &tx = e.GetTx(); + const uint256 &hash = tx.GetHash(); + if ( tx.vjoinsplit.size() == 0 ) { + mempool.addUnchecked(hash,e,true); } - BOOST_FOREACH(const CTransaction& tx, ToRemove) - { - tmpmempool.remove(tx, removed, false); - } - ToRemove.clear(); - if ( numadded == 0 ) - break; } - //if ( 0 && numadded > 0 ) - fprintf(stderr, "CC mempool add: numiters.%d remains.%d\n",numiters,(int32_t)tmpmempool.size()); + //fprintf(stderr, "finished adding back. mempoolsize.%ld\n",mempool.size()); // empty the temp mempool for next time. tmpmempool.clear(); }