mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
update python tests
Signed-off-by: Pasta <pasta@dashboost.org>
This commit is contained in:
parent
577a4ce4b8
commit
3b3132539f
@ -67,7 +67,7 @@ class MempoolPersistTest(BitcoinTestFramework):
|
|||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
self.nodes.append(start_node(0, self.options.tmpdir))
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
self.nodes.append(start_node(1, self.options.tmpdir))
|
||||||
# Give bitcoind a second to reload the mempool
|
# Give dashd a second to reload the mempool
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
assert wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
|
assert wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
|
||||||
assert_equal(len(self.nodes[1].getrawmempool()), 0)
|
assert_equal(len(self.nodes[1].getrawmempool()), 0)
|
||||||
@ -76,7 +76,7 @@ class MempoolPersistTest(BitcoinTestFramework):
|
|||||||
stop_nodes(self.nodes)
|
stop_nodes(self.nodes)
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-persistmempool=0"]))
|
self.nodes.append(start_node(0, self.options.tmpdir, ["-persistmempool=0"]))
|
||||||
# Give bitcoind a second to reload the mempool
|
# Give dashd a second to reload the mempool
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class SporkTest(BitcoinTestFramework):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
|
self.extra_args = [["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"], [], []]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
disable_mocktime()
|
disable_mocktime()
|
||||||
|
@ -303,9 +303,10 @@ class BitcoinTestFramework(object):
|
|||||||
shutil.rmtree(os.path.join(cachedir, "node" + str(i)))
|
shutil.rmtree(os.path.join(cachedir, "node" + str(i)))
|
||||||
|
|
||||||
# Create cache directories, run dashds:
|
# Create cache directories, run dashds:
|
||||||
|
set_genesis_mocktime()
|
||||||
for i in range(MAX_NODES):
|
for i in range(MAX_NODES):
|
||||||
datadir = initialize_datadir(cachedir, i)
|
datadir = initialize_datadir(cachedir, i)
|
||||||
args = [os.getenv("DASHD", "dashd"), "-server", "-keypool=1", "-datadir=" + datadir, "-discover=0"]
|
args = [os.getenv("DASHD", "dashd"), "-server", "-keypool=1", "-datadir=" + datadir, "-discover=0", "-mocktime="+str(GENESISTIME)]
|
||||||
if i > 0:
|
if i > 0:
|
||||||
args.append("-connect=127.0.0.1:" + str(p2p_port(0)))
|
args.append("-connect=127.0.0.1:" + str(p2p_port(0)))
|
||||||
bitcoind_processes[i] = subprocess.Popen(args)
|
bitcoind_processes[i] = subprocess.Popen(args)
|
||||||
@ -328,14 +329,13 @@ class BitcoinTestFramework(object):
|
|||||||
#
|
#
|
||||||
# blocks are created with timestamps 10 minutes apart
|
# blocks are created with timestamps 10 minutes apart
|
||||||
# starting from 2010 minutes in the past
|
# starting from 2010 minutes in the past
|
||||||
enable_mocktime()
|
block_time = GENESISTIME
|
||||||
block_time = get_mocktime() - (201 * 10 * 60)
|
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
for peer in range(4):
|
for peer in range(4):
|
||||||
for j in range(25):
|
for j in range(25):
|
||||||
set_node_times(self.nodes, block_time)
|
set_node_times(self.nodes, block_time)
|
||||||
self.nodes[peer].generate(1)
|
self.nodes[peer].generate(1)
|
||||||
block_time += 10 * 60
|
block_time += 156
|
||||||
# Must sync before next peer starts generating blocks
|
# Must sync before next peer starts generating blocks
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ class BitcoinTestFramework(object):
|
|||||||
from_dir = os.path.join(cachedir, "node" + str(i))
|
from_dir = os.path.join(cachedir, "node" + str(i))
|
||||||
to_dir = os.path.join(test_dir, "node" + str(i))
|
to_dir = os.path.join(test_dir, "node" + str(i))
|
||||||
shutil.copytree(from_dir, to_dir)
|
shutil.copytree(from_dir, to_dir)
|
||||||
initialize_datadir(test_dir, i) # Overwrite port/rpcport in bitcoin.conf
|
initialize_datadir(test_dir, i) # Overwrite port/rpcport in dsah.conf
|
||||||
|
|
||||||
def _initialize_chain_clean(self, test_dir, num_nodes):
|
def _initialize_chain_clean(self, test_dir, num_nodes):
|
||||||
"""Initialize empty blockchain for use by the test.
|
"""Initialize empty blockchain for use by the test.
|
||||||
|
@ -54,7 +54,7 @@ class WalletAccountsTest(BitcoinTestFramework):
|
|||||||
# send 500 from each address to a third address not in this wallet
|
# send 500 from each address to a third address not in this wallet
|
||||||
# There's some fee that will come back to us when the miner reward
|
# There's some fee that will come back to us when the miner reward
|
||||||
# matures.
|
# matures.
|
||||||
common_address = "msf4WtN1YQKXvNtvdFYt9JBnUD2FB41kjr"
|
common_address = "yd5KMREs3GLMe6mTJYr3YrH1juwNwrFCfB"
|
||||||
txid = node.sendmany(
|
txid = node.sendmany(
|
||||||
fromaccount="",
|
fromaccount="",
|
||||||
amounts={common_address: 100},
|
amounts={common_address: 100},
|
||||||
|
@ -82,7 +82,7 @@ class WalletHDTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Needs rescan
|
# Needs rescan
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
self.nodes[1] = start_node(1, self.options.tmpdir, self.extra_args[1] + ['-rescan'])
|
self.nodes[1] = start_node(1, self.options.tmpdir, self.extra_args[1] + ['-rescan'], redirect_stderr=True)
|
||||||
#connect_nodes_bi(self.nodes, 0, 1)
|
#connect_nodes_bi(self.nodes, 0, 1)
|
||||||
assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1)
|
assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user