network: rename allowMinDifficultyBlocks.
This commit is contained in:
parent
6741df1fca
commit
eb74d70e84
@ -1827,7 +1827,7 @@ Chain.prototype.getTargetAsync = function getTargetAsync(block, prev, callback)
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if ((prev.height + 1) % this.network.pow.retargetInterval !== 0) {
|
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));
|
return utils.asyncify(callback)(null, this.getTarget(block, prev));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1857,7 +1857,7 @@ Chain.prototype.getTarget = function getTarget(block, prev, ancestors) {
|
|||||||
|
|
||||||
// Do not retarget
|
// Do not retarget
|
||||||
if ((prev.height + 1) % this.network.pow.retargetInterval !== 0) {
|
if ((prev.height + 1) % this.network.pow.retargetInterval !== 0) {
|
||||||
if (this.network.pow.allowMinDifficultyBlocks) {
|
if (this.network.pow.difficultyReset) {
|
||||||
// Special behavior for testnet:
|
// Special behavior for testnet:
|
||||||
ts = block ? (block.ts || block) : bcoin.now();
|
ts = block ? (block.ts || block) : bcoin.now();
|
||||||
if (ts > prev.ts + this.network.pow.targetSpacing * 2)
|
if (ts > prev.ts + this.network.pow.targetSpacing * 2)
|
||||||
|
|||||||
@ -163,9 +163,9 @@ ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors(callba
|
|||||||
var majorityWindow = this.network.block.majorityWindow;
|
var majorityWindow = this.network.block.majorityWindow;
|
||||||
var medianTimespan = constants.block.MEDIAN_TIMESPAN;
|
var medianTimespan = constants.block.MEDIAN_TIMESPAN;
|
||||||
var powDiffInterval = this.network.pow.retargetInterval;
|
var powDiffInterval = this.network.pow.retargetInterval;
|
||||||
var allowMinDiff = this.network.pow.allowMinDifficultyBlocks;
|
var diffReset = this.network.pow.difficultyReset;
|
||||||
var max = Math.max(majorityWindow, medianTimespan);
|
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);
|
max = Math.max(max, powDiffInterval);
|
||||||
this.getAncestors(max, callback);
|
this.getAncestors(max, callback);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -219,7 +219,7 @@ main.pow = {
|
|||||||
* @default
|
* @default
|
||||||
*/
|
*/
|
||||||
|
|
||||||
allowMinDifficultyBlocks: false,
|
difficultyReset: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not allow retargetting.
|
* Do not allow retargetting.
|
||||||
@ -533,7 +533,7 @@ testnet.pow = {
|
|||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
allowMinDifficultyBlocks: true,
|
difficultyReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -682,7 +682,7 @@ regtest.pow = {
|
|||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
allowMinDifficultyBlocks: true,
|
difficultyReset: true,
|
||||||
noRetargeting: true
|
noRetargeting: true
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ segnet3.pow = {
|
|||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
allowMinDifficultyBlocks: true,
|
difficultyReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -950,7 +950,7 @@ segnet4.pow = {
|
|||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
allowMinDifficultyBlocks: true,
|
difficultyReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1094,7 +1094,7 @@ simnet.pow = {
|
|||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
allowMinDifficultyBlocks: true,
|
difficultyReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user