Browse Source

Fixed functional test cases.

views
Just Wonder 4 years ago
parent
commit
f175979d91
  1. 2
      src/chainparams.cpp
  2. 12
      test/functional/feature_block.py
  3. 2
      test/functional/test_framework/messages.py
  4. 2
      test/functional/test_framework/test_framework.py

2
src/chainparams.cpp

@ -303,7 +303,7 @@ public:
consensus.BIP34Hash = uint256(); consensus.BIP34Hash = uint256();
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests) consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests) consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
consensus.RandomXHeight = 20; // RandomxX acticated on regtest. consensus.RandomXHeight = 2000000; // RandomX acticated on regtest.
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 2.0 * 60; // Two minutes consensus.nPowTargetTimespan = 2.0 * 60; // Two minutes
consensus.nPowTargetSpacing = 2.0 * 60; // Two minutes consensus.nPowTargetSpacing = 2.0 * 60; // Two minutes

12
test/functional/feature_block.py

@ -627,6 +627,10 @@ class FullBlockTest(ComparisonTestFramework):
b44.nBits = 0x207fffff b44.nBits = 0x207fffff
b44.vtx.append(coinbase) b44.vtx.append(coinbase)
b44.hashMerkleRoot = b44.calc_merkle_root() b44.hashMerkleRoot = b44.calc_merkle_root()
b44.merkle_root = uint256_from_str(bytes.fromhex("3cf6c3b6da3f4058853ee70369ee43d473aca91ae8fc8f44a645beb21c392d80"))
b44.nNonce = height
b44.major_version = 10 # CN variant 4
b44.timestamp = b44.nTime
b44.solve() b44.solve()
self.tip = b44 self.tip = b44
self.block_heights[b44.sha256] = height self.block_heights[b44.sha256] = height
@ -642,6 +646,10 @@ class FullBlockTest(ComparisonTestFramework):
b45.nBits = 0x207fffff b45.nBits = 0x207fffff
b45.vtx.append(non_coinbase) b45.vtx.append(non_coinbase)
b45.hashMerkleRoot = b45.calc_merkle_root() b45.hashMerkleRoot = b45.calc_merkle_root()
b45.merkle_root = uint256_from_str(bytes.fromhex("3cf6c3b6da3f4058853ee70369ee43d473aca91ae8fc8f44a645beb21c392d80"))
b45.nNonce = height
b45.major_version = 10 # CN variant 4
b45.timestamp = b45.nTime
b45.calc_sha256() b45.calc_sha256()
b45.solve() b45.solve()
self.block_heights[b45.sha256] = self.block_heights[self.tip.sha256]+1 self.block_heights[b45.sha256] = self.block_heights[self.tip.sha256]+1
@ -658,6 +666,10 @@ class FullBlockTest(ComparisonTestFramework):
b46.nBits = 0x207fffff b46.nBits = 0x207fffff
b46.vtx = [] b46.vtx = []
b46.hashMerkleRoot = 0 b46.hashMerkleRoot = 0
b46.merkle_root = uint256_from_str(bytes.fromhex("3cf6c3b6da3f4058853ee70369ee43d473aca91ae8fc8f44a645beb21c392d80"))
b46.nNonce = height
b46.major_version = 10 # CN variant 4
b46.timestamp = b45.nTime
b46.solve() b46.solve()
self.block_heights[b46.sha256] = self.block_heights[b44.sha256]+1 self.block_heights[b46.sha256] = self.block_heights[b44.sha256]+1
self.tip = b46 self.tip = b46

2
test/functional/test_framework/messages.py

@ -23,7 +23,7 @@ import socket
import struct import struct
import time import time
import pycryptonight import pycryptonight # pip3 install py-cryptonight
from test_framework.siphash import siphash256 from test_framework.siphash import siphash256
from test_framework.util import hex_str_to_bytes, bytes_to_hex_str from test_framework.util import hex_str_to_bytes, bytes_to_hex_str

2
test/functional/test_framework/test_framework.py

@ -330,7 +330,7 @@ class BitcoinTestFramework():
For backwared compatibility of the python scripts with previous For backwared compatibility of the python scripts with previous
versions of the cache, this helper function sets mocktime to Jan 1, versions of the cache, this helper function sets mocktime to Jan 1,
2014 + (201 * 10 * 60)""" 2014 + (201 * 10 * 60)"""
self.mocktime = 1388534400 + (201 * 10 * 60) self.mocktime = 1582959692 + (201 * 10 * 60)
def disable_mocktime(self): def disable_mocktime(self):
self.mocktime = 0 self.mocktime = 0

Loading…
Cancel
Save