aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2021-05-14 14:20:09 +0100
committerRoss Nicoll <[email protected]>2021-05-20 12:02:35 +0100
commit878c07a847d09105bd828b9c65e83ac84da4faef (patch)
tree31769a8e75423e205a6b986c6d5576e62675233d
parentDogecoin: Update coinbase maturity (diff)
downloaddiscoin-878c07a847d09105bd828b9c65e83ac84da4faef.tar.xz
discoin-878c07a847d09105bd828b9c65e83ac84da4faef.zip
Change regtest block interval to match Dogecoin
Change regtest block interval to match Dogecoin mainnet. Note this differs from 1.14, which used special regtest values, however regtest should by default match mainnet and the server time is adjusted to make it feasible to mine blocks quickly.
-rw-r--r--src/chainparams.cpp4
-rwxr-xr-xtest/functional/mining_basic.py5
-rw-r--r--test/functional/test_framework/blocktools.py2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 10f0de408..e0c2203b1 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -393,8 +393,8 @@ public:
consensus.SegwitHeight = 0; // SEGWIT is always activated on regtest unless overridden
consensus.MinBIP9WarningHeight = 0;
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
- consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
- consensus.nPowTargetSpacing = 10 * 60;
+ consensus.nPowTargetTimespan = 4 * 60 * 60; // pre-digishield: 4 hours
+ consensus.nPowTargetSpacing = 60; // regtest: 60 second blocks
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = true;
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py
index ba467c151..160e8abb0 100755
--- a/test/functional/mining_basic.py
+++ b/test/functional/mining_basic.py
@@ -51,7 +51,7 @@ class MiningTest(BitcoinTestFramework):
def mine_chain(self):
self.log.info('Create some old blocks')
- for t in range(TIME_GENESIS_BLOCK, TIME_GENESIS_BLOCK + 200 * 600, 600):
+ for t in range(TIME_GENESIS_BLOCK, TIME_GENESIS_BLOCK + 200 * 60, 60):
self.nodes[0].setmocktime(t)
self.nodes[0].generate(1)
mining_info = self.nodes[0].getmininginfo()
@@ -86,7 +86,8 @@ class MiningTest(BitcoinTestFramework):
assert 'currentblocktx' not in mining_info
assert 'currentblockweight' not in mining_info
assert_equal(mining_info['difficulty'], Decimal('4.656542373906925E-10'))
- assert_equal(mining_info['networkhashps'], Decimal('0.003333333333333334'))
+ # Dogecoin: As the difficulty doesn't recalculate until block 240, perceived hash per second is 10x Bitcoin's value
+ assert_equal(mining_info['networkhashps'], Decimal('0.03333333333333333'))
assert_equal(mining_info['pooledtx'], 0)
# Mine a block to leave initial block download
diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py
index 6b7214f03..0c4505a47 100644
--- a/test/functional/test_framework/blocktools.py
+++ b/test/functional/test_framework/blocktools.py
@@ -64,7 +64,7 @@ def create_block(hashprev=None, coinbase=None, ntime=None, *, version=None, tmpl
if tmpl is None:
tmpl = {}
block.nVersion = version or tmpl.get('version') or 1
- block.nTime = ntime or tmpl.get('curtime') or int(time.time() + 600)
+ block.nTime = ntime or tmpl.get('curtime') or int(time.time() + 60)
block.hashPrevBlock = hashprev or int(tmpl['previousblockhash'], 0x10)
if tmpl and not tmpl.get('bits') is None:
block.nBits = struct.unpack('>I', a2b_hex(tmpl['bits']))[0]