state.hasMTP.

This commit is contained in:
Christopher Jeffrey 2016-06-30 11:27:09 -07:00
parent 4b7d4a3c8d
commit c8dc5901ec
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -593,9 +593,7 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
}
// Get timestamp for tx.isFinal().
ts = (state.lockFlags & constants.flags.MEDIAN_TIME_PAST) !== 0
? medianTime
: block.ts;
ts = state.hasMTP() ? medianTime : block.ts;
// Check all transactions
for (i = 0; i < block.txs.length; i++) {
@ -2546,6 +2544,15 @@ DeploymentState.prototype.hasCLTV = function hasCLTV() {
return (this.flags & constants.flags.VERIFY_CHECKLOCKTIMEVERIFY) !== 0;
};
/**
* Test whether median time past locktime is active.
* @returns {Boolean}
*/
DeploymentState.prototype.hasMTP = function hasMTP() {
return (this.lockFlags & constants.flags.MEDIAN_TIME_PAST) !== 0
};
/**
* Test whether csv is active.
* @returns {Boolean}