Fix issues with set_test_params and start/stop_node

This commit is contained in:
Alexander Block 2019-09-24 00:56:31 +02:00
parent 703f4c77a7
commit ac0f483d85
12 changed files with 70 additions and 94 deletions

View File

@ -15,19 +15,18 @@ import binascii
class AddressIndexTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
def setup_network(self):
self.nodes = []
self.add_nodes(self.num_nodes)
# Nodes 0/1 are "wallet" nodes
self.nodes.append(self.start_node(0, self.options.tmpdir, ["-relaypriority=0"]))
self.nodes.append(self.start_node(1, self.options.tmpdir, ["-addressindex"]))
self.start_node(0, ["-relaypriority=0"])
self.start_node(1, ["-addressindex"])
# Nodes 2/3 are used for testing
self.nodes.append(self.start_node(2, self.options.tmpdir, ["-addressindex", "-relaypriority=0"]))
self.nodes.append(self.start_node(3, self.options.tmpdir, ["-addressindex"]))
self.start_node(2, ["-addressindex", "-relaypriority=0"])
self.start_node(3, ["-addressindex"])
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)
connect_nodes(self.nodes[0], 3)

View File

@ -11,8 +11,7 @@ from test_framework.util import *
# Create one-input, one-output, no-fee transaction:
class RawTransactionsTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
self.extra_args = [['-usehd=1']] * self.num_nodes
@ -444,7 +443,6 @@ class RawTransactionsTest(BitcoinTestFramework):
self.stop_node(2)
self.stop_node(3)
self.nodes[1].node_encrypt_wallet("test")
self.nodes.pop(1)
self.start_nodes()
# This test is not meant to test fee estimation and we'd like

View File

@ -14,8 +14,7 @@ from test_framework.util import *
class KeyPoolTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [['-usehd=1']]

View File

@ -74,7 +74,7 @@ class LLMQChainLocksTest(DashTestFramework):
good_tip = self.nodes[0].getbestblockhash()
# Restart it so that it forgets all the chainlocks from the past
self.stop_node(0)
self.nodes[0] = self.start_node(0, self.options.tmpdir, self.extra_args)
self.start_node(0)
connect_nodes(self.nodes[0], 1)
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
# Now try to reorg the chain

View File

@ -21,15 +21,12 @@ can change it again.
class MultiKeySporkTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.num_nodes = 5
self.setup_clean_chain = True
self.is_network_split = False
def setup_network(self):
self.nodes = []
# secret(base58): 931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F
# keyid(hex): 60f0f57f71f0081f1aacdd8432340a33a526f91b
# address(base58): yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa
@ -50,46 +47,43 @@ class MultiKeySporkTest(BitcoinTestFramework):
# keyid(hex): 1d1098b2b1f759b678a0a7a098637a9b898adcac
# address(base58): yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui
self.nodes.append(self.start_node(0, self.options.tmpdir,
["-sporkkey=931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"]))
self.nodes.append(self.start_node(1, self.options.tmpdir,
["-sporkkey=91vbXGMSWKGHom62986XtL1q2mQDA12ngcuUNNe5NfMSj44j7g3",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"]))
self.nodes.append(self.start_node(2, self.options.tmpdir,
["-sporkkey=92bxUjPT5AhgXuXJwfGGXqhomY2SdQ55MYjXyx9DZNxCABCSsRH",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"]))
self.nodes.append(self.start_node(3, self.options.tmpdir,
["-sporkkey=934yPXiVGf4RCY2qTs2Bt5k3TEtAiAg12sMxCt8yVWbSU7p3fuD",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"]))
self.nodes.append(self.start_node(4, self.options.tmpdir,
["-sporkkey=92Cxwia363Wg2qGF1fE5z4GKi8u7r1nrWQXdtsj2ACZqaDPSihD",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"]))
self.add_nodes(5)
self.start_node(0, ["-sporkkey=931wyuRNVYvhg18Uu9bky5Qg1z4QbxaJ7fefNBzjBPiLRqcd33F",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"])
self.start_node(1, ["-sporkkey=91vbXGMSWKGHom62986XtL1q2mQDA12ngcuUNNe5NfMSj44j7g3",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"])
self.start_node(2, ["-sporkkey=92bxUjPT5AhgXuXJwfGGXqhomY2SdQ55MYjXyx9DZNxCABCSsRH",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"])
self.start_node(3, ["-sporkkey=934yPXiVGf4RCY2qTs2Bt5k3TEtAiAg12sMxCt8yVWbSU7p3fuD",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"])
self.start_node(4, ["-sporkkey=92Cxwia363Wg2qGF1fE5z4GKi8u7r1nrWQXdtsj2ACZqaDPSihD",
"-sporkaddr=ygcG5S2pQz2U1UAaHvU6EznKZW7yapKMA7",
"-sporkaddr=yfLSXFfipnkgYioD6L8aUNyfRgEBuJv48h",
"-sporkaddr=yNsMZhEhYqv14TgdYb1NS2UmNZjE8FSJxa",
"-sporkaddr=ycbRQWbovrhQMTuxg9p4LAuW5SCMAKqPrn",
"-sporkaddr=yc5TGfcHYoLCrcbVy4umsiDjsYUn39vLui",
"-minsporkkeys=3"])
# connect nodes at start
for i in range(0, 5):
for j in range(i, 5):

View File

@ -29,11 +29,6 @@ from test_framework.util import (
p2p_port)
class P2PFingerprintTest(BitcoinTestFramework):
def __init__(self):
BitcoinTestFramework.__init__(self)
# TODO When this asserts, you have probably backported bitcoin#11121, so you'll have to remove this constructor
assert(not callable(getattr(BitcoinTestFramework(), "set_test_params", None)))
self.set_test_params()
def set_test_params(self):
self.setup_clean_chain = True

View File

@ -59,12 +59,8 @@ class FullBlockTest(ComparisonTestFramework):
self.coinbase_pubkey = self.coinbase_key.get_pubkey()
self.tip = None
self.blocks = {}
def setup_network(self):
# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-whitelist=127.0.0.1', '-dip3params=2000:2000']],
binary=[self.options.testbinary])
self.extra_args = [['-whitelist=127.0.0.1', '-dip3params=2000:2000']]
def add_options(self, parser):
super().add_options(parser)

View File

@ -44,8 +44,7 @@ class GetblockstatsTest(BitcoinTestFramework):
help='Test data file')
# def set_test_params(self):
def __init__(self):
super().__init__()
def set_test_params(self):
self.num_nodes = 2
self.extra_args = [['-txindex'], ['-txindex=0', '-paytxfee=0.003']]
self.setup_clean_chain = True

View File

@ -15,19 +15,18 @@ import binascii
class SpentIndexTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
def setup_network(self):
self.nodes = []
self.add_nodes(self.num_nodes)
# Nodes 0/1 are "wallet" nodes
self.nodes.append(self.start_node(0, self.options.tmpdir))
self.nodes.append(self.start_node(1, self.options.tmpdir, ["-spentindex"]))
self.start_node(0)
self.start_node(1, ["-spentindex"])
# Nodes 2/3 are used for testing
self.nodes.append(self.start_node(2, self.options.tmpdir, ["-spentindex"]))
self.nodes.append(self.start_node(3, self.options.tmpdir, ["-spentindex", "-txindex"]))
self.start_node(2, ["-spentindex"])
self.start_node(3, ["-spentindex", "-txindex"])
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)
connect_nodes(self.nodes[0], 3)

View File

@ -12,8 +12,7 @@ from test_framework.util import *
'''
class SporkTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.num_nodes = 3
self.setup_clean_chain = True
self.extra_args = [["-sporkkey=cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK"], [], []]
@ -59,8 +58,8 @@ class SporkTest(BitcoinTestFramework):
# restart nodes to check spork persistence
self.stop_node(0)
self.stop_node(1)
self.nodes[0] = self.start_node(0, self.options.tmpdir)
self.nodes[1] = self.start_node(1, self.options.tmpdir)
self.start_node(0)
self.start_node(1)
assert(self.get_test_spork_state(self.nodes[0]))
assert(self.get_test_spork_state(self.nodes[1]))

View File

@ -13,19 +13,18 @@ from test_framework.util import *
class TimestampIndexTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
def setup_network(self):
self.nodes = []
self.add_nodes(self.num_nodes)
# Nodes 0/1 are "wallet" nodes
self.nodes.append(self.start_node(0, self.options.tmpdir))
self.nodes.append(self.start_node(1, self.options.tmpdir, ["-timestampindex"]))
self.start_node(0)
self.start_node(1, ["-timestampindex"])
# Nodes 2/3 are used for testing
self.nodes.append(self.start_node(2, self.options.tmpdir))
self.nodes.append(self.start_node(3, self.options.tmpdir, ["-timestampindex"]))
self.start_node(2)
self.start_node(3, ["-timestampindex"])
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)
connect_nodes(self.nodes[0], 3)

View File

@ -15,19 +15,18 @@ import binascii
class TxIndexTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 4
def setup_network(self):
self.nodes = []
self.add_nodes(self.num_nodes)
# Nodes 0/1 are "wallet" nodes
self.nodes.append(self.start_node(0, self.options.tmpdir))
self.nodes.append(self.start_node(1, self.options.tmpdir, ["-txindex"]))
self.start_node(0)
self.start_node(1, ["-txindex"])
# Nodes 2/3 are used for testing
self.nodes.append(self.start_node(2, self.options.tmpdir, ["-txindex"]))
self.nodes.append(self.start_node(3, self.options.tmpdir, ["-txindex"]))
self.start_node(2, ["-txindex"])
self.start_node(3, ["-txindex"])
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)
connect_nodes(self.nodes[0], 3)