chain: fix retarget.

This commit is contained in:
Christopher Jeffrey 2016-08-17 17:07:33 -07:00
parent 4b85715ec2
commit 731e615b86
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1883,7 +1883,7 @@ Chain.prototype.getTarget = function getTarget(block, prev, ancestors) {
assert(first);
this.retarget(prev, first);
return this.retarget(prev, first);
};
/**
@ -2029,7 +2029,7 @@ Chain.prototype.getState = function getState(prev, id, callback) {
if (stateCache[entry.hash] != null)
return walkForward(stateCache[entry.hash]);
return entry.getMedianTimeAsync(function(err, medianTime) {
entry.getMedianTimeAsync(function(err, medianTime) {
if (err)
return walk(err);
@ -2040,7 +2040,7 @@ Chain.prototype.getState = function getState(prev, id, callback) {
height = entry.height - period;
return entry.getAncestorByHeight(height, walk);
entry.getAncestorByHeight(height, walk);
});
})(null, prev);
@ -2120,9 +2120,10 @@ Chain.prototype.getState = function getState(prev, id, callback) {
case constants.thresholdStates.ACTIVE:
stateCache[entry.hash] = state;
return walkForward(state);
default:
assert(false, 'Bad state.');
break;
}
assert(false, 'Bad state.');
}
};