network: fix/improve some chain params.

This commit is contained in:
Christopher Jeffrey 2017-01-23 03:42:50 -08:00
parent cbb45db801
commit a52db227e3
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 33 additions and 22 deletions

View File

@ -1887,7 +1887,7 @@ Chain.prototype.getTargetAsync = co(function* getTargetAsync(block, prev) {
var ancestors;
if ((prev.height + 1) % pow.retargetInterval !== 0) {
if (!pow.difficultyReset)
if (!pow.targetReset)
return this.getTarget(block, prev);
}
@ -1915,7 +1915,7 @@ Chain.prototype.getTarget = function getTarget(block, prev, ancestors) {
// Do not retarget
if ((prev.height + 1) % pow.retargetInterval !== 0) {
if (pow.difficultyReset) {
if (pow.targetReset) {
// Special behavior for testnet:
ts = block ? (block.ts || block) : this.network.now();
if (ts > prev.ts + pow.targetSpacing * 2)

View File

@ -171,7 +171,7 @@ ChainEntry.prototype.isGenesis = function isGenesis() {
ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors() {
var timespan = ChainEntry.MEDIAN_TIMESPAN;
var interval = this.chain.network.pow.retargetInterval;
var reset = this.chain.network.pow.difficultyReset;
var reset = this.chain.network.pow.targetReset;
var max = timespan;
if ((this.height + 1) % interval === 0 || reset)

View File

@ -185,12 +185,12 @@ main.pow = {
),
/**
* Default retarget interval.
* Desired retarget period in seconds.
* @const {Number}
* @default
*/
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetTimespan: 14 * 24 * 60 * 60,
/**
* Average block time.
@ -209,12 +209,13 @@ main.pow = {
retargetInterval: 2016,
/**
* Allow constant retargetting on testnet.
* Whether to reset target if a block
* has not been mined recently.
* @const {Boolean}
* @default
*/
difficultyReset: false,
targetReset: false,
/**
* Do not allow retargetting.
@ -543,10 +544,10 @@ testnet.pow = {
'00000000000000000000000000000000000000000000001e345893fa639796e9',
'hex'
),
targetTimespan: 14 * 24 * 60 * 60, // two weeks
targetTimespan: 14 * 24 * 60 * 60,
targetSpacing: 10 * 60,
retargetInterval: 2016,
difficultyReset: true,
targetReset: true,
noRetargeting: false
};
@ -691,11 +692,14 @@ regtest.pow = {
'hex'
),
bits: 545259519,
chainwork: new BN(0),
targetTimespan: 14 * 24 * 60 * 60, // two weeks
chainwork: new BN(
'0000000000000000000000000000000000000000000000000000000000000002',
'hex'
),
targetTimespan: 14 * 24 * 60 * 60,
targetSpacing: 10 * 60,
retargetInterval: 2016,
difficultyReset: true,
targetReset: true,
noRetargeting: true
};
@ -708,8 +712,8 @@ regtest.block = {
bip66hash: null,
pruneAfterHeight: 1000,
keepBlocks: 10000,
maxTipAge: 24 * 60 * 60,
slowHeight: 0x7fffffff
maxTipAge: 0xffffffff,
slowHeight: 0
};
regtest.bip30 = {};
@ -841,11 +845,14 @@ segnet4.pow = {
'hex'
),
bits: 503447551,
chainwork: new BN(0),
targetTimespan: 14 * 24 * 60 * 60, // two weeks
chainwork: new BN(
'0000000000000000000000000000000000000000000000000000000000800040',
'hex'
),
targetTimespan: 14 * 24 * 60 * 60,
targetSpacing: 10 * 60,
retargetInterval: 2016,
difficultyReset: true,
targetReset: true,
noRetargeting: false
};
@ -858,8 +865,8 @@ segnet4.block = {
bip66hash: '6c48386dc7c460defabb5640e28b6510a5f238cdbe6756c2976a7e0913000000',
pruneAfterHeight: 1000,
keepBlocks: 10000,
maxTipAge: 24 * 60 * 60,
slowHeight: 0x7fffffff
maxTipAge: 7 * 24 * 60 * 60,
slowHeight: 50000
};
segnet4.bip30 = {};
@ -984,10 +991,14 @@ simnet.pow = {
'hex'
),
bits: 545259519,
targetTimespan: 14 * 24 * 60 * 60, // two weeks
chainwork: new BN(
'0000000000000000000000000000000000000000000000000000000000000002',
'hex'
),
targetTimespan: 14 * 24 * 60 * 60,
targetSpacing: 10 * 60,
retargetInterval: 2016,
difficultyReset: true,
targetReset: true,
noRetargeting: false
};
@ -1000,7 +1011,7 @@ simnet.block = {
bip66hash: 'f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e68',
pruneAfterHeight: 1000,
keepBlocks: 10000,
maxTipAge: 0x7fffffff,
maxTipAge: 0xffffffff,
slowHeight: 0
};