From eb74d70e84157c484ce7327a24824b789eccdffd Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 8 Sep 2016 18:08:16 -0700 Subject: [PATCH] network: rename allowMinDifficultyBlocks. --- lib/chain/chain.js | 4 ++-- lib/chain/chainentry.js | 4 ++-- lib/protocol/networks.js | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/chain/chain.js b/lib/chain/chain.js index 37e51fcd..bb2280f3 100644 --- a/lib/chain/chain.js +++ b/lib/chain/chain.js @@ -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) diff --git a/lib/chain/chainentry.js b/lib/chain/chainentry.js index 5942556e..2644d046 100644 --- a/lib/chain/chainentry.js +++ b/lib/chain/chainentry.js @@ -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); }; diff --git a/lib/protocol/networks.js b/lib/protocol/networks.js index 460ccf3f..4448d299 100644 --- a/lib/protocol/networks.js +++ b/lib/protocol/networks.js @@ -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 };