optimization for checkFinal.

This commit is contained in:
Christopher Jeffrey 2016-05-09 09:34:43 -07:00
parent d5c9c31534
commit 2189d79c47
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -2384,6 +2384,10 @@ Chain.prototype.checkFinal = function checkFinal(prev, tx, flags, callback) {
return callback(null, tx.isFinal(height, ts));
}
// We can skip MTP if the locktime is height.
if (tx.locktime < constants.LOCKTIME_THRESHOLD)
return utils.asyncify(check)(null, -1);
if (flags & constants.flags.MEDIAN_TIME_PAST)
return prev.getMedianTimeAsync(check);