mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Fix stderr related issues
Also remove use of stderr=sys.stdout for tests where it's not needed anymore
This commit is contained in:
parent
39a1c6452f
commit
703f4c77a7
@ -242,7 +242,7 @@ class DIP3Test(BitcoinTestFramework):
|
|||||||
while len(self.nodes) <= mn.idx:
|
while len(self.nodes) <= mn.idx:
|
||||||
self.add_nodes(1)
|
self.add_nodes(1)
|
||||||
extra_args = ['-masternode=1', '-masternodeblsprivkey=%s' % mn.blsMnkey]
|
extra_args = ['-masternode=1', '-masternodeblsprivkey=%s' % mn.blsMnkey]
|
||||||
self.start_node(mn.idx, extra_args = self.extra_args + extra_args, stderr=sys.stdout)
|
self.start_node(mn.idx, extra_args = self.extra_args + extra_args)
|
||||||
for i in range(0, len(self.nodes)):
|
for i in range(0, len(self.nodes)):
|
||||||
if i < len(self.nodes) and self.nodes[i] is not None and self.nodes[i].process is not None and i != mn.idx:
|
if i < len(self.nodes) and self.nodes[i] is not None and self.nodes[i].process is not None and i != mn.idx:
|
||||||
connect_nodes_bi(self.nodes, mn.idx, i)
|
connect_nodes_bi(self.nodes, mn.idx, i)
|
||||||
|
@ -16,9 +16,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
self.extra_args = [['-usehd=1']] * self.num_nodes
|
self.extra_args = [['-usehd=1']] * self.num_nodes
|
||||||
|
self.stderr = sys.stdout
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.setup_nodes(stderr=sys.stdout)
|
super().setup_network()
|
||||||
connect_nodes_bi(self.nodes,0,1)
|
connect_nodes_bi(self.nodes,0,1)
|
||||||
connect_nodes_bi(self.nodes,1,2)
|
connect_nodes_bi(self.nodes,1,2)
|
||||||
connect_nodes_bi(self.nodes,0,2)
|
connect_nodes_bi(self.nodes,0,2)
|
||||||
@ -445,7 +446,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||||||
self.nodes[1].node_encrypt_wallet("test")
|
self.nodes[1].node_encrypt_wallet("test")
|
||||||
self.nodes.pop(1)
|
self.nodes.pop(1)
|
||||||
|
|
||||||
self.nodes = self.start_nodes(4, self.options.tmpdir, [['-usehd=1']] * self.num_nodes, stderr=sys.stdout)
|
self.start_nodes()
|
||||||
# This test is not meant to test fee estimation and we'd like
|
# This test is not meant to test fee estimation and we'd like
|
||||||
# to be sure all txs are sent at a consistent desired feerate
|
# to be sure all txs are sent at a consistent desired feerate
|
||||||
for node in self.nodes:
|
for node in self.nodes:
|
||||||
|
@ -123,7 +123,7 @@ class ImportRescanTest(BitcoinTestFramework):
|
|||||||
extra_args[i] += ["-prune=1", "-txindex=0", "-reindex"]
|
extra_args[i] += ["-prune=1", "-txindex=0", "-reindex"]
|
||||||
|
|
||||||
self.add_nodes(self.num_nodes, extra_args)
|
self.add_nodes(self.num_nodes, extra_args)
|
||||||
self.start_nodes(stderr=sys.stdout)
|
self.start_nodes()
|
||||||
for i in range(1, self.num_nodes):
|
for i in range(1, self.num_nodes):
|
||||||
connect_nodes(self.nodes[i], 0)
|
connect_nodes(self.nodes[i], 0)
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ class KeyPoolTest(BitcoinTestFramework):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [['-usehd=1']]
|
||||||
|
self.stderr = sys.stdout
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
nodes = self.nodes
|
nodes = self.nodes
|
||||||
@ -29,7 +31,7 @@ class KeyPoolTest(BitcoinTestFramework):
|
|||||||
# Encrypt wallet and wait to terminate
|
# Encrypt wallet and wait to terminate
|
||||||
nodes[0].node_encrypt_wallet('test')
|
nodes[0].node_encrypt_wallet('test')
|
||||||
# Restart node 0
|
# Restart node 0
|
||||||
nodes[0] = self.start_node(0, self.options.tmpdir, ['-usehd=1'], stderr=sys.stdout)
|
self.start_node(0)
|
||||||
# Keep creating keys
|
# Keep creating keys
|
||||||
addr = nodes[0].getnewaddress()
|
addr = nodes[0].getnewaddress()
|
||||||
addr_data = nodes[0].validateaddress(addr)
|
addr_data = nodes[0].validateaddress(addr)
|
||||||
@ -104,8 +106,5 @@ class KeyPoolTest(BitcoinTestFramework):
|
|||||||
assert_equal(wi['keypoolsize_hd_internal'], 100)
|
assert_equal(wi['keypoolsize_hd_internal'], 100)
|
||||||
assert_equal(wi['keypoolsize'], 100)
|
assert_equal(wi['keypoolsize'], 100)
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = self.start_nodes(1, self.options.tmpdir, [['-usehd=1']], stderr=sys.stdout)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
KeyPoolTest().main()
|
KeyPoolTest().main()
|
||||||
|
@ -25,9 +25,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=100', '-keypoolmin=20']]
|
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=100', '-keypoolmin=20']]
|
||||||
|
self.stderr = sys.stdout
|
||||||
def setup_network(self):
|
|
||||||
self.setup_nodes(stderr=sys.stdout)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.tmpdir = self.options.tmpdir
|
self.tmpdir = self.options.tmpdir
|
||||||
@ -38,7 +36,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
|||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
|
|
||||||
shutil.copyfile(self.tmpdir + "/node1/regtest/wallet.dat", self.tmpdir + "/wallet.bak")
|
shutil.copyfile(self.tmpdir + "/node1/regtest/wallet.dat", self.tmpdir + "/wallet.bak")
|
||||||
self.start_node(1, self.extra_args[1], stderr=sys.stdout)
|
self.start_node(1, self.extra_args[1])
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
connect_nodes_bi(self.nodes, 0, 1)
|
||||||
|
|
||||||
self.log.info("Generate keys for wallet")
|
self.log.info("Generate keys for wallet")
|
||||||
@ -64,7 +62,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.log.info("Verify keypool is restored and balance is correct")
|
self.log.info("Verify keypool is restored and balance is correct")
|
||||||
|
|
||||||
self.start_node(1, self.extra_args[1], stderr=sys.stdout)
|
self.start_node(1, self.extra_args[1])
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
connect_nodes_bi(self.nodes, 0, 1)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
|||||||
from test_framework.util import *
|
from test_framework.util import *
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
MIN_BLOCKS_TO_KEEP = 288
|
MIN_BLOCKS_TO_KEEP = 288
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
sync_blocks(self.nodes[0:5])
|
sync_blocks(self.nodes[0:5])
|
||||||
|
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
self.add_nodes(self.num_nodes, self.extra_args, timewait=900)
|
self.add_nodes(self.num_nodes, self.extra_args, timewait=900, stderr=sys.stdout)
|
||||||
self.start_nodes()
|
self.start_nodes()
|
||||||
|
|
||||||
def create_big_chain(self):
|
def create_big_chain(self):
|
||||||
@ -229,14 +230,14 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
def manual_test(self, node_number, use_timestamp):
|
def manual_test(self, node_number, use_timestamp):
|
||||||
# at this point, node has 995 blocks and has not yet run in prune mode
|
# at this point, node has 995 blocks and has not yet run in prune mode
|
||||||
self.start_node(node_number, extra_args=["-litemode", "-txindex=0"], stderr=sys.stdout)
|
self.start_node(node_number, extra_args=["-litemode", "-txindex=0"])
|
||||||
node = self.nodes[node_number]
|
node = self.nodes[node_number]
|
||||||
assert_equal(node.getblockcount(), 995)
|
assert_equal(node.getblockcount(), 995)
|
||||||
assert_raises_jsonrpc(-1, "not in prune mode", node.pruneblockchain, 500)
|
assert_raises_jsonrpc(-1, "not in prune mode", node.pruneblockchain, 500)
|
||||||
|
|
||||||
# now re-start in manual pruning mode
|
# now re-start in manual pruning mode
|
||||||
self.stop_node(node_number)
|
self.stop_node(node_number)
|
||||||
self.start_node(node_number, extra_args=["-litemode", "-txindex=0", "-prune=1"], stderr=sys.stdout)
|
self.start_node(node_number, extra_args=["-litemode", "-txindex=0", "-prune=1"])
|
||||||
node = self.nodes[node_number]
|
node = self.nodes[node_number]
|
||||||
assert_equal(node.getblockcount(), 995)
|
assert_equal(node.getblockcount(), 995)
|
||||||
|
|
||||||
@ -311,7 +312,7 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# stop node, start back up with auto-prune at 550MB, make sure still runs
|
# stop node, start back up with auto-prune at 550MB, make sure still runs
|
||||||
self.stop_node(node_number)
|
self.stop_node(node_number)
|
||||||
self.start_node(node_number, extra_args=["-litemode", "-txindex=0", "-prune=550"], stderr=sys.stdout)
|
self.start_node(node_number, extra_args=["-litemode", "-txindex=0", "-prune=550"])
|
||||||
|
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
# check that the pruning node's wallet is still in good shape
|
# check that the pruning node's wallet is still in good shape
|
||||||
self.log.info("Stop and start pruning node to trigger wallet rescan")
|
self.log.info("Stop and start pruning node to trigger wallet rescan")
|
||||||
self.stop_node(2)
|
self.stop_node(2)
|
||||||
self.start_node(2, extra_args=["-litemode", "-txindex=0", "-prune=550"], stderr=sys.stdout)
|
self.start_node(2, extra_args=["-litemode", "-txindex=0", "-prune=550"])
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
# check that wallet loads successfully when restarting a pruned node after IBD.
|
# check that wallet loads successfully when restarting a pruned node after IBD.
|
||||||
@ -329,7 +330,7 @@ class PruneTest(BitcoinTestFramework):
|
|||||||
nds = [self.nodes[0], self.nodes[5]]
|
nds = [self.nodes[0], self.nodes[5]]
|
||||||
sync_blocks(nds, wait=5, timeout=300)
|
sync_blocks(nds, wait=5, timeout=300)
|
||||||
self.stop_node(5) #stop and start to trigger rescan
|
self.stop_node(5) #stop and start to trigger rescan
|
||||||
self.start_node(5, extra_args=["-litemode", "-txindex=0", "-prune=550"], stderr=sys.stdout)
|
self.start_node(5, extra_args=["-litemode", "-txindex=0", "-prune=550"])
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
@ -71,7 +71,7 @@ class WalletDumpTest(BitcoinTestFramework):
|
|||||||
# longer than the default 30 seconds due to an expensive
|
# longer than the default 30 seconds due to an expensive
|
||||||
# CWallet::TopUpKeyPool call, and the encryptwallet RPC made later in
|
# CWallet::TopUpKeyPool call, and the encryptwallet RPC made later in
|
||||||
# the test often takes even longer.
|
# the test often takes even longer.
|
||||||
self.add_nodes(self.num_nodes, self.extra_args, timewait=60)
|
self.add_nodes(self.num_nodes, self.extra_args, timewait=60, stderr=sys.stdout)
|
||||||
self.start_nodes()
|
self.start_nodes()
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
|
@ -17,7 +17,8 @@ class WalletHDTest(BitcoinTestFramework):
|
|||||||
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']]
|
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.setup_nodes(stderr=sys.stdout)
|
self.add_nodes(self.num_nodes, self.extra_args, stderr=sys.stdout)
|
||||||
|
self.start_nodes()
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
tmpdir = self.options.tmpdir
|
tmpdir = self.options.tmpdir
|
||||||
@ -25,7 +26,7 @@ class WalletHDTest(BitcoinTestFramework):
|
|||||||
# Make sure can't switch off usehd after wallet creation
|
# Make sure can't switch off usehd after wallet creation
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
self.assert_start_raises_init_error(1, ['-usehd=0'], 'already existing HD wallet')
|
self.assert_start_raises_init_error(1, ['-usehd=0'], 'already existing HD wallet')
|
||||||
self.start_node(1, stderr=sys.stdout)
|
self.start_node(1)
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
connect_nodes_bi(self.nodes, 0, 1)
|
||||||
|
|
||||||
# Make sure we use hd, keep chainid
|
# Make sure we use hd, keep chainid
|
||||||
@ -77,7 +78,7 @@ class WalletHDTest(BitcoinTestFramework):
|
|||||||
shutil.rmtree(tmpdir + "/node1/regtest/evodb")
|
shutil.rmtree(tmpdir + "/node1/regtest/evodb")
|
||||||
shutil.rmtree(tmpdir + "/node1/regtest/llmq")
|
shutil.rmtree(tmpdir + "/node1/regtest/llmq")
|
||||||
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
|
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
|
||||||
self.start_node(1, stderr=sys.stdout)
|
self.start_node(1)
|
||||||
|
|
||||||
# Assert that derivation is deterministic
|
# Assert that derivation is deterministic
|
||||||
hd_add_2 = None
|
hd_add_2 = None
|
||||||
@ -92,7 +93,7 @@ class WalletHDTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Needs rescan
|
# Needs rescan
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
self.start_node(1, extra_args=self.extra_args[1] + ['-rescan'], stderr=sys.stdout)
|
self.start_node(1, extra_args=self.extra_args[1] + ['-rescan'])
|
||||||
assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1)
|
assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1)
|
||||||
|
|
||||||
# send a tx and make sure its using the internal chain for the changeoutput
|
# send a tx and make sure its using the internal chain for the changeoutput
|
||||||
|
Loading…
Reference in New Issue
Block a user