network: fix/improve some chain params.
This commit is contained in:
parent
cbb45db801
commit
a52db227e3
@ -1887,7 +1887,7 @@ Chain.prototype.getTargetAsync = co(function* getTargetAsync(block, prev) {
|
|||||||
var ancestors;
|
var ancestors;
|
||||||
|
|
||||||
if ((prev.height + 1) % pow.retargetInterval !== 0) {
|
if ((prev.height + 1) % pow.retargetInterval !== 0) {
|
||||||
if (!pow.difficultyReset)
|
if (!pow.targetReset)
|
||||||
return this.getTarget(block, prev);
|
return this.getTarget(block, prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1915,7 +1915,7 @@ Chain.prototype.getTarget = function getTarget(block, prev, ancestors) {
|
|||||||
|
|
||||||
// Do not retarget
|
// Do not retarget
|
||||||
if ((prev.height + 1) % pow.retargetInterval !== 0) {
|
if ((prev.height + 1) % pow.retargetInterval !== 0) {
|
||||||
if (pow.difficultyReset) {
|
if (pow.targetReset) {
|
||||||
// Special behavior for testnet:
|
// Special behavior for testnet:
|
||||||
ts = block ? (block.ts || block) : this.network.now();
|
ts = block ? (block.ts || block) : this.network.now();
|
||||||
if (ts > prev.ts + pow.targetSpacing * 2)
|
if (ts > prev.ts + pow.targetSpacing * 2)
|
||||||
|
|||||||
@ -171,7 +171,7 @@ ChainEntry.prototype.isGenesis = function isGenesis() {
|
|||||||
ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors() {
|
ChainEntry.prototype.getRetargetAncestors = function getRetargetAncestors() {
|
||||||
var timespan = ChainEntry.MEDIAN_TIMESPAN;
|
var timespan = ChainEntry.MEDIAN_TIMESPAN;
|
||||||
var interval = this.chain.network.pow.retargetInterval;
|
var interval = this.chain.network.pow.retargetInterval;
|
||||||
var reset = this.chain.network.pow.difficultyReset;
|
var reset = this.chain.network.pow.targetReset;
|
||||||
var max = timespan;
|
var max = timespan;
|
||||||
|
|
||||||
if ((this.height + 1) % interval === 0 || reset)
|
if ((this.height + 1) % interval === 0 || reset)
|
||||||
|
|||||||
@ -185,12 +185,12 @@ main.pow = {
|
|||||||
),
|
),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default retarget interval.
|
* Desired retarget period in seconds.
|
||||||
* @const {Number}
|
* @const {Number}
|
||||||
* @default
|
* @default
|
||||||
*/
|
*/
|
||||||
|
|
||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Average block time.
|
* Average block time.
|
||||||
@ -209,12 +209,13 @@ main.pow = {
|
|||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow constant retargetting on testnet.
|
* Whether to reset target if a block
|
||||||
|
* has not been mined recently.
|
||||||
* @const {Boolean}
|
* @const {Boolean}
|
||||||
* @default
|
* @default
|
||||||
*/
|
*/
|
||||||
|
|
||||||
difficultyReset: false,
|
targetReset: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not allow retargetting.
|
* Do not allow retargetting.
|
||||||
@ -543,10 +544,10 @@ testnet.pow = {
|
|||||||
'00000000000000000000000000000000000000000000001e345893fa639796e9',
|
'00000000000000000000000000000000000000000000001e345893fa639796e9',
|
||||||
'hex'
|
'hex'
|
||||||
),
|
),
|
||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
targetTimespan: 14 * 24 * 60 * 60,
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
difficultyReset: true,
|
targetReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -691,11 +692,14 @@ regtest.pow = {
|
|||||||
'hex'
|
'hex'
|
||||||
),
|
),
|
||||||
bits: 545259519,
|
bits: 545259519,
|
||||||
chainwork: new BN(0),
|
chainwork: new BN(
|
||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
'0000000000000000000000000000000000000000000000000000000000000002',
|
||||||
|
'hex'
|
||||||
|
),
|
||||||
|
targetTimespan: 14 * 24 * 60 * 60,
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
difficultyReset: true,
|
targetReset: true,
|
||||||
noRetargeting: true
|
noRetargeting: true
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -708,8 +712,8 @@ regtest.block = {
|
|||||||
bip66hash: null,
|
bip66hash: null,
|
||||||
pruneAfterHeight: 1000,
|
pruneAfterHeight: 1000,
|
||||||
keepBlocks: 10000,
|
keepBlocks: 10000,
|
||||||
maxTipAge: 24 * 60 * 60,
|
maxTipAge: 0xffffffff,
|
||||||
slowHeight: 0x7fffffff
|
slowHeight: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
regtest.bip30 = {};
|
regtest.bip30 = {};
|
||||||
@ -841,11 +845,14 @@ segnet4.pow = {
|
|||||||
'hex'
|
'hex'
|
||||||
),
|
),
|
||||||
bits: 503447551,
|
bits: 503447551,
|
||||||
chainwork: new BN(0),
|
chainwork: new BN(
|
||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
'0000000000000000000000000000000000000000000000000000000000800040',
|
||||||
|
'hex'
|
||||||
|
),
|
||||||
|
targetTimespan: 14 * 24 * 60 * 60,
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
difficultyReset: true,
|
targetReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -858,8 +865,8 @@ segnet4.block = {
|
|||||||
bip66hash: '6c48386dc7c460defabb5640e28b6510a5f238cdbe6756c2976a7e0913000000',
|
bip66hash: '6c48386dc7c460defabb5640e28b6510a5f238cdbe6756c2976a7e0913000000',
|
||||||
pruneAfterHeight: 1000,
|
pruneAfterHeight: 1000,
|
||||||
keepBlocks: 10000,
|
keepBlocks: 10000,
|
||||||
maxTipAge: 24 * 60 * 60,
|
maxTipAge: 7 * 24 * 60 * 60,
|
||||||
slowHeight: 0x7fffffff
|
slowHeight: 50000
|
||||||
};
|
};
|
||||||
|
|
||||||
segnet4.bip30 = {};
|
segnet4.bip30 = {};
|
||||||
@ -984,10 +991,14 @@ simnet.pow = {
|
|||||||
'hex'
|
'hex'
|
||||||
),
|
),
|
||||||
bits: 545259519,
|
bits: 545259519,
|
||||||
targetTimespan: 14 * 24 * 60 * 60, // two weeks
|
chainwork: new BN(
|
||||||
|
'0000000000000000000000000000000000000000000000000000000000000002',
|
||||||
|
'hex'
|
||||||
|
),
|
||||||
|
targetTimespan: 14 * 24 * 60 * 60,
|
||||||
targetSpacing: 10 * 60,
|
targetSpacing: 10 * 60,
|
||||||
retargetInterval: 2016,
|
retargetInterval: 2016,
|
||||||
difficultyReset: true,
|
targetReset: true,
|
||||||
noRetargeting: false
|
noRetargeting: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1000,7 +1011,7 @@ simnet.block = {
|
|||||||
bip66hash: 'f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e68',
|
bip66hash: 'f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e68',
|
||||||
pruneAfterHeight: 1000,
|
pruneAfterHeight: 1000,
|
||||||
keepBlocks: 10000,
|
keepBlocks: 10000,
|
||||||
maxTipAge: 0x7fffffff,
|
maxTipAge: 0xffffffff,
|
||||||
slowHeight: 0
|
slowHeight: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user