network: rename allowMinDifficultyBlocks.

This commit is contained in:
Christopher Jeffrey 2016-09-08 18:08:16 -07:00
parent 6741df1fca
commit eb74d70e84
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 10 additions and 10 deletions

View File

@ -1827,7 +1827,7 @@ Chain.prototype.getTargetAsync = function getTargetAsync(block, prev, callback)
var self = this;
if ((prev.height + 1) % this.network.pow.retargetInterval !== 0) {
if (!this.network.pow.allowMinDifficultyBlocks)
if (!this.network.pow.difficultyReset)
return utils.asyncify(callback)(null, this.getTarget(block, prev));
}
@ -1857,7 +1857,7 @@ Chain.prototype.getTarget = function getTarget(block, prev, ancestors) {
// Do not retarget
if ((prev.height + 1) % this.network.pow.retargetInterval !== 0) {
if (this.network.pow.allowMinDifficultyBlocks) {
if (this.network.pow.difficultyReset) {
// Special behavior for testnet:
ts = block ? (block.ts || block) : bcoin.now();
if (ts > prev.ts + this.network.pow.targetSpacing * 2)

View File

@ -163,9 +163,9 @@ ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors(callba
var majorityWindow = this.network.block.majorityWindow;
var medianTimespan = constants.block.MEDIAN_TIMESPAN;
var powDiffInterval = this.network.pow.retargetInterval;
var allowMinDiff = this.network.pow.allowMinDifficultyBlocks;
var diffReset = this.network.pow.difficultyReset;
var max = Math.max(majorityWindow, medianTimespan);
if ((this.height + 1) % powDiffInterval === 0 || allowMinDiff)
if ((this.height + 1) % powDiffInterval === 0 || diffReset)
max = Math.max(max, powDiffInterval);
this.getAncestors(max, callback);
};

View File

@ -219,7 +219,7 @@ main.pow = {
* @default
*/
allowMinDifficultyBlocks: false,
difficultyReset: false,
/**
* Do not allow retargetting.
@ -533,7 +533,7 @@ testnet.pow = {
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetSpacing: 10 * 60,
retargetInterval: 2016,
allowMinDifficultyBlocks: true,
difficultyReset: true,
noRetargeting: false
};
@ -682,7 +682,7 @@ regtest.pow = {
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetSpacing: 10 * 60,
retargetInterval: 2016,
allowMinDifficultyBlocks: true,
difficultyReset: true,
noRetargeting: true
};
@ -828,7 +828,7 @@ segnet3.pow = {
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetSpacing: 10 * 60,
retargetInterval: 2016,
allowMinDifficultyBlocks: true,
difficultyReset: true,
noRetargeting: false
};
@ -950,7 +950,7 @@ segnet4.pow = {
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetSpacing: 10 * 60,
retargetInterval: 2016,
allowMinDifficultyBlocks: true,
difficultyReset: true,
noRetargeting: false
};
@ -1094,7 +1094,7 @@ simnet.pow = {
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetSpacing: 10 * 60,
retargetInterval: 2016,
allowMinDifficultyBlocks: true,
difficultyReset: true,
noRetargeting: false
};