From e18da34468508f11f4d5f8438a0d5ed27bf086bf Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 1 Jul 2021 13:34:56 +0100 Subject: [PATCH] miner: Set coinbase expiry height to block height from NU5 activation --- src/miner.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 63e31031a..31dcf5279 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -293,8 +293,14 @@ CMutableTransaction CreateCoinbaseTransaction(const CChainParams& chainparams, C CMutableTransaction mtx = CreateNewContextualCMutableTransaction(chainparams.GetConsensus(), nHeight); mtx.vin.resize(1); mtx.vin[0].prevout.SetNull(); - // Set to 0 so expiry height does not apply to coinbase txs - mtx.nExpiryHeight = 0; + if (chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_NU5)) { + // ZIP 203: From NU5 onwards, nExpiryHeight is set to the block height in + // coinbase transactions. + mtx.nExpiryHeight = nHeight; + } else { + // Set to 0 so expiry height does not apply to coinbase txs + mtx.nExpiryHeight = 0; + } // Add outputs and sign std::visit(