This commit is contained in:
jl777
2017-03-24 22:28:13 +02:00
parent eeef062480
commit 14aa6cc0e2
5 changed files with 61 additions and 184 deletions

View File

@@ -202,16 +202,13 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
? nMedianTimePast
: pblock->GetBlockTime();
if (tx.IsCoinBase() || !IsFinalTx(&expired,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS,chainActive.Tip()->nTime))
{
if ( expired != 0 )
{
fprintf(stderr,"expire from mempool tx. need to verify this works\n");//(%d %d) %.8f\n",tx.vins.size(),tx.vouts.size(),(double)tx.vouts[0].nValue/COIN);
//list<CTransaction> removed;
//mempool.remove(tx, removed, true);
}
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff))
continue;
} //else fprintf(stderr,"coinbase or is finaltx (%d %u)\n",(int32_t)nHeight,(uint32_t)tx.nLockTime);
if ( 0 && komodo_validate_interest(tx,pblock->nHeight,(uint32_t)pblock->nTime) < 0 )
{
fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure\n");
continue;
}
COrphan* porphan = NULL;
double dPriority = 0;
CAmount nTotalIn = 0;
@@ -438,8 +435,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
static uint32_t counter;
if ( counter++ < 100 )
fprintf(stderr,"warning: testblockvalidity failed\n");
//return(0);
throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed");
return(0);
}
}
@@ -891,6 +887,12 @@ void static BitcoinMiner(CWallet *pwallet)
// Changing pblock->nTime can change work required on testnet:
hashTarget.SetCompact(pblock->nBits);
}
CValidationState state;
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false))
{
fprintf(stderr,"formerly valid mining block became invalid, likely due to tx expiration\n");
break;
}
}
}
}