miner: cheat on testnet.

This commit is contained in:
Christopher Jeffrey 2016-12-14 10:07:54 -08:00
parent 65ddc563d6
commit 1c08beba0a
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -321,9 +321,9 @@ Miner.prototype.createBlock = co(function* createBlock(tip, address) {
version = yield this.chain.computeBlockVersion(tip);
// Cheat on testnet.
// if (this.network.difficultyReset) {
// if (this.network.pow.difficultyReset) {
// median = yield tip.getMedianTimeAsync();
// ts = cheat(tip.ts, median, now);
// ts = cheat(tip.ts, median, now, this.network.pow.targetSpacing);
// locktime = ts;
// }
@ -548,8 +548,8 @@ function cmpRate(a, b) {
return a.rate - b.rate;
}
function cheat(prevTime, now, medianTime) {
var resetTime = prevTime + (20 * 60);
function cheat(prevTime, medianTime, now, targetSpacing) {
var resetTime = prevTime + (targetSpacing * 2) + 1;
// Already easy.
if (now <= resetTime)