Clarify nLockTime-by-time comment in CheckFinalTx()

This commit is contained in:
Peter Todd 2015-11-13 16:36:54 -05:00
parent 748321eb5b
commit c277a63ed7
No known key found for this signature in database
GPG Key ID: C085F21CE7F4B9DC
1 changed files with 5 additions and 4 deletions

View File

@ -670,10 +670,11 @@ bool CheckFinalTx(const CTransaction &tx, int flags)
// IsFinalTx() with one more than chainActive.Height(). // IsFinalTx() with one more than chainActive.Height().
const int nBlockHeight = chainActive.Height() + 1; const int nBlockHeight = chainActive.Height() + 1;
// Timestamps on the other hand don't get any special treatment, // BIP113 will require that time-locked transactions have nLockTime set to
// because we can't know what timestamp the next block will have, // less than the median time of the previous block they're contained in.
// and there aren't timestamp applications where it matters. // When the next block is created its previous block will be the current
// However this changes once median past time-locks are enforced: // chain tip, so we use that to calculate the median time passed to
// IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set.
const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST) const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST)
? chainActive.Tip()->GetMedianTimePast() ? chainActive.Tip()->GetMedianTimePast()
: GetAdjustedTime(); : GetAdjustedTime();