aboutsummaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorMark Friedenbach <mark@friedenbach.org>2015-06-03 12:55:45 -0700
committerMark Friedenbach <mark@friedenbach.org>2015-10-23 09:02:24 -0700
commit9d55050773d57c0e12005e524f2e54d9e622c6e2 (patch)
tree5e07889ff64f153d39b0a4b06d5e2ac29621153f /src/consensus
parent46f74379b86be982b121bcb8c3cfe07fa80bffd0 (diff)
downloadbitcoin-9d55050773d57c0e12005e524f2e54d9e622c6e2.tar.xz
Add rules--presently disabled--for using GetMedianTimePast as endpoint for lock-time calculations
The lock-time code currently uses CBlock::nTime as the cutoff point for time based locked transactions. This has the unfortunate outcome of creating a perverse incentive for miners to lie about the time of a block in order to collect more fees by including transactions that by wall clock determination have not yet matured. By using CBlockIndex::GetMedianTimePast from the prior block instead, the self-interested miner no longer gains from generating blocks with fraudulent timestamps. Users can compensate for this change by simply adding an hour (3600 seconds) to their time-based lock times. If enforced, this would be a soft-fork change. This commit only adds the functionality on an unexecuted code path, without changing the behaviour of Bitcoin Core.
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/consensus.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h
index f937844e9f..6d6ce7e099 100644
--- a/src/consensus/consensus.h
+++ b/src/consensus/consensus.h
@@ -13,4 +13,10 @@ static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
static const int COINBASE_MATURITY = 100;
+/** Flags for LockTime() */
+enum {
+ /* Use GetMedianTimePast() instead of nTime for end point timestamp. */
+ LOCKTIME_MEDIAN_TIME_PAST = (1 << 1),
+};
+
#endif // BITCOIN_CONSENSUS_CONSENSUS_H