diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-02-15 05:13:27 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-03-15 16:54:38 +0100 |
commit | 6851107b3a52ec869e5e3a2cb4eb02d6c743b8e5 (patch) | |
tree | 352e161e37993cd6f68c11d25c99606492829130 /src/miner.cpp | |
parent | a6a860796a44a2805a58391a009ba22752f64e32 (diff) |
BIP9 Implementation
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and
based on code by Jorge Timon.
Diffstat (limited to 'src/miner.cpp')
-rw-r--r-- | src/miner.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/miner.cpp b/src/miner.cpp index ec87e84ca7..ef8fd4db43 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -79,11 +79,6 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience - // -regtest only: allow overriding block.nVersion with - // -blockversion=N to test forking scenarios - if (chainparams.MineBlocksOnDemand()) - pblock->nVersion = GetArg("-blockversion", pblock->nVersion); - // Create coinbase tx CMutableTransaction txNew; txNew.vin.resize(1); @@ -137,6 +132,12 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s pblock->nTime = GetAdjustedTime(); const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast(); + pblock->nVersion = ComputeBlockVersion(pindexPrev, chainparams.GetConsensus()); + // -regtest only: allow overriding block.nVersion with + // -blockversion=N to test forking scenarios + if (chainparams.MineBlocksOnDemand()) + pblock->nVersion = GetArg("-blockversion", pblock->nVersion); + int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST) ? nMedianTimePast : pblock->GetBlockTime(); |