Implement transaction expiry for Overwinter

This commit is contained in:
Jay Graber
2018-02-21 20:21:06 -08:00
parent c5904fb2a4
commit 9bb37bf0d5
11 changed files with 99 additions and 10 deletions

View File

@@ -166,7 +166,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
? nMedianTimePast
: pblock->GetBlockTime();
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff))
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight))
continue;
COrphan* porphan = NULL;
@@ -345,6 +345,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
txNew.vout.resize(1);
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
txNew.vout[0].nValue = GetBlockSubsidy(nHeight, chainparams.GetConsensus());
// Set to 0 so expiry height does not apply to coinbase txs
txNew.nExpiryHeight = 0;
if ((nHeight > 0) && (nHeight <= chainparams.GetConsensus().GetLastFoundersRewardBlockHeight())) {
// Founders reward is 20% of the block subsidy