aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-11-05 12:12:50 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-11-05 12:13:04 +0100
commit3038eb63e8a674b4818cb5d5e461f1ccf4b2932f (patch)
tree1017d21cb0b94b3108b079a8c0611dbc7ba5851e /src/miner.cpp
parent3694b74fa9c85e07ddbd3583154b38cd3b39f640 (diff)
parentd1c3762ae8c8c73ddd47766041507a6c131afaf2 (diff)
downloadbitcoin-3038eb63e8a674b4818cb5d5e461f1ccf4b2932f.tar.xz
Merge pull request #6934
d1c3762 Revert "Revert "Enable policy enforcing GetMedianTimePast as the end point of lock-time constraints"" (Gregory Maxwell) e4e5334 Restore MedianTimePast for locktime. (Gregory Maxwell)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index 42c8bb970b..053d9cdbc4 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -148,6 +148,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
CBlockIndex* pindexPrev = chainActive.Tip();
const int nHeight = pindexPrev->nHeight + 1;
pblock->nTime = GetAdjustedTime();
+ const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
CCoinsViewCache view(pcoinsTip);
// Priority order to process transactions
@@ -162,7 +163,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
mi != mempool.mapTx.end(); ++mi)
{
const CTransaction& tx = mi->GetTx();
- if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, pblock->nTime))
+
+ int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST)
+ ? nMedianTimePast
+ : pblock->GetBlockTime();
+
+ if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff))
continue;
COrphan* porphan = NULL;