From c1b0a84b3a2a6bf904c180f10068f5c321f0c866 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 24 Jan 2021 13:29:27 -0500 Subject: [PATCH] Cleanup dead code and less logspam --- src/main.cpp | 98 +++------------------------------------------------- 1 file changed, 4 insertions(+), 94 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index beab6356a..19c365b08 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5004,68 +5004,6 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C if ( ASSETCHAINS_CC != 0 && !fCheckPOW ) return true; - /* - bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false; - if (ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order - { - 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. - 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(); - const uint256 &hash = tx.GetHash(); - if ( tx.vjoinsplit.empty() && tx.vShieldedSpend.empty()) { - transactionsToRemove.push_back(tx); - tmpmempool.addUnchecked(hash,e,true); - } - } - BOOST_FOREACH(const CTransaction& tx, transactionsToRemove) { - list removed; - mempool.remove(tx, removed, false); - } - // add all the txs in the block to the empty mempool. - // CC validation shouldnt (cant) depend on the state of mempool! - while ( 1 ) - { - list removed; - for (i=0; i all tx in mempool\n",lastrejects); - break; - } - //fprintf(stderr,"addtomempool ht.%d for CC checking: n.%d rejects.%d last.%d\n",height,(int32_t)block.vtx.size(),rejects,lastrejects); - lastrejects = rejects; - rejects = 0; - } - //fprintf(stderr,"done putting block's tx into mempool\n"); - } - */ for (uint32_t i = 0; i < block.vtx.size(); i++) { @@ -5082,31 +5020,6 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, error("CheckBlock: out-of-bounds SigOpCount"), REJECT_INVALID, "bad-blk-sigops", true); - /* - if ( fCheckPOW && komodo_check_deposit(height,block,(pindex==0||pindex->pprev==0)?0:pindex->pprev->nTime) < 0 ) - { - //static uint32_t counter; - //if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 ) - // fprintf(stderr,"check deposit rejection\n"); - LogPrintf("CheckBlockHeader komodo_check_deposit error"); - return(false); - } - - if ( ASSETCHAINS_CC != 0 ) - { - LOCK2(cs_main,mempool.cs); - // here we add back all txs from the temp mempool to the main mempool. - BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx) - { - const CTransaction &tx = e.GetTx(); - const uint256 &hash = tx.GetHash(); - mempool.addUnchecked(hash,e,true); - } - //fprintf(stderr, "finished adding back. mempoolsize.%ld\n",mempool.size()); - // empty the temp mempool for next time. - tmpmempool.clear(); - } - */ return true; } @@ -5130,16 +5043,13 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta unsigned int nNextWork = GetNextWorkRequired(pindexPrev, &block, consensusParams); //if ((nHeight < 340000 || nHeight > 342500) && block.nBits != nNextWork) { if (block.nBits != nNextWork) { - cout << "Incorrect HUSH diffbits at height " << nHeight << - " " << block.nBits << " block.nBits vs. calc " << nNextWork << - " " << block.GetHash().ToString() << " @ " << block.GetBlockTime() << endl; - // Don't use this CLI option unless you know what you are doing -- Duke - //if(!GetArg("-dev-ignore-bad-nbits",false)) { + //cout << "Incorrect HUSH diffbits at height " << nHeight << + // " " << block.nBits << " block.nBits vs. calc " << nNextWork << + // " " << block.GetHash().ToString() << " @ " << block.GetBlockTime() << endl; if (nHeight < 340000) { return state.DoS(100, error("%s: Incorrect diffbits at height %d", __func__, nHeight), REJECT_INVALID, "bad-diffbits"); } else { - LogPrintf("%s: Ignoring nbits calc : %lu\n",__func__, nNextWork ); - LogPrintf("%s: Ignoring nbits block: %lu\n",__func__, block.nBits ); + LogPrintf("%s: Ignoring nbits calc : %lu vs block %lu\n",__func__, nNextWork, block.nBits ); cout << "Ignoring nbits for height=" << nHeight << endl; } }