refactor.
This commit is contained in:
parent
ebe3b3ed54
commit
af8e3945b7
@ -289,8 +289,9 @@ ChainEntry.prototype.getMedianTime = function getMedianTime(ancestors) {
|
|||||||
|
|
||||||
ChainEntry.prototype.getMedianTimeAsync = function getMedianTimeAsync(callback) {
|
ChainEntry.prototype.getMedianTimeAsync = function getMedianTimeAsync(callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var MEDIAN_TIMESPAN = constants.block.MEDIAN_TIMESPAN;
|
||||||
|
|
||||||
return this.getAncestors(constants.block.MEDIAN_TIMESPAN, function(err, ancestors) {
|
return this.getAncestors(MEDIAN_TIMESPAN, function(err, ancestors) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
@ -306,7 +307,9 @@ ChainEntry.prototype.getMedianTimeAsync = function getMedianTimeAsync(callback)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ChainEntry.prototype.isOutdated = function isOutdated(version, ancestors) {
|
ChainEntry.prototype.isOutdated = function isOutdated(version, ancestors) {
|
||||||
return this.isSuperMajority(version, this.network.block.majorityRejectOutdated, ancestors);
|
return this.isSuperMajority(version,
|
||||||
|
this.network.block.majorityRejectOutdated,
|
||||||
|
ancestors);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,8 +320,7 @@ ChainEntry.prototype.isOutdated = function isOutdated(version, ancestors) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ChainEntry.prototype.isOutdatedAsync = function isOutdatedAsync(version, callback) {
|
ChainEntry.prototype.isOutdatedAsync = function isOutdatedAsync(version, callback) {
|
||||||
return this.isSuperMajorityAsync(
|
return this.isSuperMajorityAsync(version,
|
||||||
version,
|
|
||||||
this.network.block.majorityRejectOutdated,
|
this.network.block.majorityRejectOutdated,
|
||||||
callback);
|
callback);
|
||||||
};
|
};
|
||||||
@ -331,7 +333,9 @@ ChainEntry.prototype.isOutdatedAsync = function isOutdatedAsync(version, callbac
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ChainEntry.prototype.isUpgraded = function isUpgraded(version, ancestors) {
|
ChainEntry.prototype.isUpgraded = function isUpgraded(version, ancestors) {
|
||||||
return this.isSuperMajority(version, this.network.block.majorityEnforceUpgrade, ancestors);
|
return this.isSuperMajority(version,
|
||||||
|
this.network.block.majorityEnforceUpgrade,
|
||||||
|
ancestors);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -342,8 +346,7 @@ ChainEntry.prototype.isUpgraded = function isUpgraded(version, ancestors) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ChainEntry.prototype.isUpgradedAsync = function isUpgradedAsync(version, callback) {
|
ChainEntry.prototype.isUpgradedAsync = function isUpgradedAsync(version, callback) {
|
||||||
return this.isSuperMajorityAsync(
|
return this.isSuperMajorityAsync(version,
|
||||||
version,
|
|
||||||
this.network.block.majorityEnforceUpgrade,
|
this.network.block.majorityEnforceUpgrade,
|
||||||
callback);
|
callback);
|
||||||
};
|
};
|
||||||
@ -381,8 +384,9 @@ ChainEntry.prototype.isSuperMajority = function isSuperMajority(version, require
|
|||||||
|
|
||||||
ChainEntry.prototype.isSuperMajorityAsync = function isSuperMajorityAsync(version, required, callback) {
|
ChainEntry.prototype.isSuperMajorityAsync = function isSuperMajorityAsync(version, required, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var majorityWindow = this.network.block.majorityWindow;
|
||||||
|
|
||||||
return this.getAncestors(this.network.block.majorityWindow, function(err, ancestors) {
|
return this.getAncestors(majorityWindow, function(err, ancestors) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user