Merge #10198: [tests] Remove is_network_split from functional test framework
c9cc76d
[tests] Remove is_network_split from funtional test cases (John Newbery)
Tree-SHA512: a43ec63a7dc20cbe9048f8d3af755aef55e9247f605d6481e6d665112882a749af7514f29c83ca9d761421b8e0f7282e5b9f8fc471985d222de826da7cc80ccf
This commit is contained in:
commit
dc8fc0c73b
67 changed files with 142 additions and 374 deletions
|
@ -20,12 +20,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.00001"]))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.nodes[1].generate(100)
|
self.nodes[1].generate(100)
|
||||||
|
|
|
@ -39,12 +39,7 @@ class BIP65Test(ComparisonTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=3']]
|
||||||
def setup_network(self):
|
|
||||||
# Must set the blockversion for this test
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[['-whitelist=127.0.0.1', '-blockversion=3']],
|
|
||||||
binary=[self.options.testbinary])
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
test = TestManager(self, self.options.tmpdir)
|
test = TestManager(self, self.options.tmpdir)
|
||||||
|
|
|
@ -12,15 +12,12 @@ class BIP65Test(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [[], ["-blockversion=3"], ["-blockversion=4"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, []))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-blockversion=3"]))
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-blockversion=4"]))
|
|
||||||
connect_nodes(self.nodes[1], 0)
|
connect_nodes(self.nodes[1], 0)
|
||||||
connect_nodes(self.nodes[2], 0)
|
connect_nodes(self.nodes[2], 0)
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -95,12 +95,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4']]
|
||||||
def setup_network(self):
|
|
||||||
# Must set the blockversion for this test
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[['-whitelist=127.0.0.1', '-blockversion=4']],
|
|
||||||
binary=[self.options.testbinary])
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
test = TestManager(self, self.options.tmpdir)
|
test = TestManager(self, self.options.tmpdir)
|
||||||
|
|
|
@ -21,16 +21,11 @@ class BIP68Test(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [[], ["-acceptnonstdtxn=0"]]
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-acceptnonstdtxn=0"]))
|
|
||||||
self.is_network_split = False
|
|
||||||
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
|
||||||
|
|
||||||
# Generate some coins
|
# Generate some coins
|
||||||
self.nodes[0].generate(110)
|
self.nodes[0].generate(110)
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,7 @@ class BIP9SoftForksTest(ComparisonTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [['-whitelist=127.0.0.1']]
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[['-whitelist=127.0.0.1']],
|
|
||||||
binary=[self.options.testbinary])
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.test = TestManager(self, self.options.tmpdir)
|
self.test = TestManager(self, self.options.tmpdir)
|
||||||
|
|
|
@ -47,12 +47,6 @@ class BIP66Test(ComparisonTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
# Must set the blockversion for this test
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[['-whitelist=127.0.0.1', '-blockversion=2']],
|
|
||||||
binary=[self.options.testbinary])
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
test = TestManager(self, self.options.tmpdir)
|
test = TestManager(self, self.options.tmpdir)
|
||||||
test.add_all_connections(self.nodes)
|
test.add_all_connections(self.nodes)
|
||||||
|
|
|
@ -12,15 +12,12 @@ class BIP66Test(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [[], ["-blockversion=2"], ["-blockversion=3"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, []))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-blockversion=2"]))
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-blockversion=3"]))
|
|
||||||
connect_nodes(self.nodes[1], 0)
|
connect_nodes(self.nodes[1], 0)
|
||||||
connect_nodes(self.nodes[2], 0)
|
connect_nodes(self.nodes[2], 0)
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -35,12 +35,6 @@ class BlockchainTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self._test_gettxoutsetinfo()
|
self._test_gettxoutsetinfo()
|
||||||
self._test_getblockheader()
|
self._test_getblockheader()
|
||||||
|
|
|
@ -47,7 +47,6 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||||
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
|
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
|
||||||
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
connect_nodes_bi(self.nodes, 0, 1)
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -16,10 +16,6 @@ class DecodeScriptTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def decodescript_script_sig(self):
|
def decodescript_script_sig(self):
|
||||||
signature = '304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001'
|
signature = '304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001'
|
||||||
push_signature = '48' + signature
|
push_signature = '48' + signature
|
||||||
|
|
|
@ -18,11 +18,7 @@ class DisableWalletTest (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 = [["-disablewallet"]]
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [['-disablewallet']])
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
|
x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
|
||||||
|
|
|
@ -20,10 +20,6 @@ class DisconnectBanTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = self.setup_nodes()
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Test setban and listbanned RPCs")
|
self.log.info("Test setban and listbanned RPCs")
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ class ForkNotifyTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
|
||||||
alert_filename = None # Set by setup_network
|
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
|
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
|
||||||
|
@ -30,7 +28,6 @@ class ForkNotifyTest(BitcoinTestFramework):
|
||||||
["-blockversion=211"]))
|
["-blockversion=211"]))
|
||||||
connect_nodes(self.nodes[1], 0)
|
connect_nodes(self.nodes[1], 0)
|
||||||
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -23,15 +23,12 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self, split=False):
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
self.setup_nodes()
|
||||||
|
|
||||||
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)
|
||||||
connect_nodes_bi(self.nodes,0,3)
|
connect_nodes_bi(self.nodes, 0, 3)
|
||||||
|
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
|
min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||||
|
@ -467,7 +464,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
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)
|
||||||
connect_nodes_bi(self.nodes,0,3)
|
connect_nodes_bi(self.nodes,0,3)
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
# drain the keypool
|
# drain the keypool
|
||||||
|
|
|
@ -73,10 +73,6 @@ class GetBlockTemplateProposalTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = self.setup_nodes()
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
node.generate(1) # Mine a block to leave initial block download
|
node.generate(1) # Mine a block to leave initial block download
|
||||||
|
|
|
@ -31,7 +31,7 @@ class GetChainTipsTest (BitcoinTestFramework):
|
||||||
self.split_network ()
|
self.split_network ()
|
||||||
self.nodes[0].generate(10)
|
self.nodes[0].generate(10)
|
||||||
self.nodes[2].generate(20)
|
self.nodes[2].generate(20)
|
||||||
self.sync_all ()
|
self.sync_all([self.nodes[:2], self.nodes[2:]])
|
||||||
|
|
||||||
tips = self.nodes[1].getchaintips ()
|
tips = self.nodes[1].getchaintips ()
|
||||||
assert_equal (len (tips), 1)
|
assert_equal (len (tips), 1)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = self.setup_nodes()
|
self.setup_nodes()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,8 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self):
|
||||||
self.nodes = start_nodes(2, self.options.tmpdir)
|
self.setup_nodes()
|
||||||
self.is_network_split=False
|
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
self.log.info("Mining blocks...")
|
self.log.info("Mining blocks...")
|
||||||
|
|
|
@ -14,12 +14,6 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
connect_nodes_bi(self.nodes,0,1)
|
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Mining blocks...")
|
self.log.info("Mining blocks...")
|
||||||
self.nodes[0].generate(101)
|
self.nodes[0].generate(101)
|
||||||
|
|
|
@ -8,20 +8,15 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import *
|
from test_framework.util import *
|
||||||
|
|
||||||
class InvalidateTest(BitcoinTestFramework):
|
class InvalidateTest(BitcoinTestFramework):
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
self.is_network_split = False
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir))
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Make sure we repopulate setBlockIndexCandidates after InvalidateBlock:")
|
self.log.info("Make sure we repopulate setBlockIndexCandidates after InvalidateBlock:")
|
||||||
self.log.info("Mine 4 blocks on Node 0")
|
self.log.info("Mine 4 blocks on Node 0")
|
||||||
|
|
|
@ -84,8 +84,5 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = self.setup_nodes()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
KeyPoolTest().main()
|
KeyPoolTest().main()
|
||||||
|
|
|
@ -43,7 +43,6 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||||
This test only checks that [tx0] is present.
|
This test only checks that [tx0] is present.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
assert_equal(self.is_network_split, False)
|
|
||||||
self.nodes[2].generate(101)
|
self.nodes[2].generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
|
@ -54,7 +53,6 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||||
|
|
||||||
# Split network into two
|
# Split network into two
|
||||||
self.split_network()
|
self.split_network()
|
||||||
assert_equal(self.is_network_split, True)
|
|
||||||
|
|
||||||
# send to nodes[0] from nodes[2]
|
# send to nodes[0] from nodes[2]
|
||||||
senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
||||||
|
@ -64,7 +62,7 @@ class ListSinceBlockTest (BitcoinTestFramework):
|
||||||
self.nodes[2].generate(7)
|
self.nodes[2].generate(7)
|
||||||
self.log.info('lastblockhash=%s' % (lastblockhash))
|
self.log.info('lastblockhash=%s' % (lastblockhash))
|
||||||
|
|
||||||
self.sync_all()
|
self.sync_all([self.nodes[:2], self.nodes[2:]])
|
||||||
|
|
||||||
self.join_network()
|
self.join_network()
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
#This test requires mocktime
|
#This test requires mocktime
|
||||||
enable_mocktime()
|
enable_mocktime()
|
||||||
return start_nodes(self.num_nodes, self.options.tmpdir)
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Simple send, 0 to 1:
|
# Simple send, 0 to 1:
|
||||||
|
|
|
@ -35,15 +35,11 @@ class MaxUploadTest(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 = [["-maxuploadtarget=800", "-blockmaxsize=999000"]]
|
||||||
|
|
||||||
# Cache for utxos, as the listunspent may take a long time later in the test
|
# Cache for utxos, as the listunspent may take a long time later in the test
|
||||||
self.utxo_cache = []
|
self.utxo_cache = []
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
# Start a node with maxuploadtarget of 200 MB (/24h)
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxuploadtarget=800", "-blockmaxsize=999000"]))
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Before we connect anything, we first set the time on the node
|
# Before we connect anything, we first set the time on the node
|
||||||
# to be in the past, otherwise things break because the CNode
|
# to be in the past, otherwise things break because the CNode
|
||||||
|
|
|
@ -9,30 +9,25 @@ from test_framework.util import *
|
||||||
|
|
||||||
class MempoolLimitTest(BitcoinTestFramework):
|
class MempoolLimitTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxmempool=5", "-spendzeroconfchange=0"]))
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
self.relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
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 = [["-maxmempool=5", "-spendzeroconfchange=0"]]
|
||||||
self.txouts = gen_return_txouts()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
txouts = gen_return_txouts()
|
||||||
|
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||||
|
|
||||||
txids = []
|
txids = []
|
||||||
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 91)
|
utxos = create_confirmed_utxos(relayfee, self.nodes[0], 91)
|
||||||
|
|
||||||
#create a mempool tx that will be evicted
|
#create a mempool tx that will be evicted
|
||||||
us0 = utxos.pop()
|
us0 = utxos.pop()
|
||||||
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
||||||
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
||||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||||
self.nodes[0].settxfee(self.relayfee) # specifically fund this tx with low fee
|
self.nodes[0].settxfee(relayfee) # specifically fund this tx with low fee
|
||||||
txF = self.nodes[0].fundrawtransaction(tx)
|
txF = self.nodes[0].fundrawtransaction(tx)
|
||||||
self.nodes[0].settxfee(0) # return to automatic fee selection
|
self.nodes[0].settxfee(0) # return to automatic fee selection
|
||||||
txFS = self.nodes[0].signrawtransaction(txF['hex'])
|
txFS = self.nodes[0].signrawtransaction(txF['hex'])
|
||||||
|
@ -42,7 +37,7 @@ class MempoolLimitTest(BitcoinTestFramework):
|
||||||
base_fee = relayfee*100
|
base_fee = relayfee*100
|
||||||
for i in range (3):
|
for i in range (3):
|
||||||
txids.append([])
|
txids.append([])
|
||||||
txids[i] = create_lots_of_big_transactions(self.nodes[0], self.txouts, utxos[30*i:30*i+30], 30, (i+1)*base_fee)
|
txids[i] = create_lots_of_big_transactions(self.nodes[0], txouts, utxos[30*i:30*i+30], 30, (i+1)*base_fee)
|
||||||
|
|
||||||
# by now, the tx should be evicted, check confirmation state
|
# by now, the tx should be evicted, check confirmation state
|
||||||
assert(txid not in self.nodes[0].getrawmempool())
|
assert(txid not in self.nodes[0].getrawmempool())
|
||||||
|
|
|
@ -16,14 +16,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount=5"]]
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxorphantx=1000"]))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-maxorphantx=1000", "-limitancestorcount=5"]))
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
# Build a transaction that spends parent_txid:vout
|
# Build a transaction that spends parent_txid:vout
|
||||||
# Return amount sent
|
# Return amount sent
|
||||||
|
|
|
@ -17,18 +17,10 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [["-checkmempool"]] * 2
|
||||||
|
|
||||||
alert_filename = None # Set by setup_network
|
alert_filename = None # Set by setup_network
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
args = ["-checkmempool"]
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, args))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, args))
|
|
||||||
connect_nodes(self.nodes[1], 0)
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Start with a 200 block chain
|
# Start with a 200 block chain
|
||||||
assert_equal(self.nodes[0].getblockcount(), 200)
|
assert_equal(self.nodes[0].getblockcount(), 200)
|
||||||
|
|
|
@ -14,13 +14,8 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
# Just need one node for this test
|
# Just need one node for this test
|
||||||
args = ["-checkmempool"]
|
self.extra_args = [["-checkmempool"]]
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, args))
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
node0_address = self.nodes[0].getnewaddress()
|
node0_address = self.nodes[0].getnewaddress()
|
||||||
|
|
|
@ -22,13 +22,7 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args = [["-checkmempool"]]
|
||||||
def setup_network(self):
|
|
||||||
# Just need one node for this test
|
|
||||||
args = ["-checkmempool"]
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, args))
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
chain_height = self.nodes[0].getblockcount()
|
chain_height = self.nodes[0].getblockcount()
|
||||||
|
|
|
@ -13,20 +13,15 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
|
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
|
||||||
|
self.extra_args = [[], [], [], ["-txindex"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
# Nodes 0/1 are "wallet" nodes
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
|
||||||
# Nodes 2/3 are used for testing
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir))
|
|
||||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-txindex"]))
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
connect_nodes(self.nodes[0], 1)
|
||||||
connect_nodes(self.nodes[0], 2)
|
connect_nodes(self.nodes[0], 2)
|
||||||
connect_nodes(self.nodes[0], 3)
|
connect_nodes(self.nodes[0], 3)
|
||||||
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -27,9 +27,6 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||||
f.write(rpcauth+"\n")
|
f.write(rpcauth+"\n")
|
||||||
f.write(rpcauth2+"\n")
|
f.write(rpcauth2+"\n")
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = self.setup_nodes()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
|
|
|
@ -25,12 +25,6 @@ class NetTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self._test_connection_count()
|
self._test_connection_count()
|
||||||
self._test_getnettotals()
|
self._test_getnettotals()
|
||||||
|
|
|
@ -41,11 +41,7 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
|
self.extra_args = [['-whitelist=127.0.0.1', '-walletprematurewitness']]
|
||||||
def setup_network(self):
|
|
||||||
# Must set the blockversion for this test
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[['-whitelist=127.0.0.1', '-walletprematurewitness']])
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.address = self.nodes[0].getnewaddress()
|
self.address = self.nodes[0].getnewaddress()
|
||||||
|
|
|
@ -64,17 +64,13 @@ class AcceptBlockTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
self.extra_args = [[], ["-whitelist=127.0.0.1"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
# Node0 will be used to test behavior of processing unrequested blocks
|
# Node0 will be used to test behavior of processing unrequested blocks
|
||||||
# from peers which are not whitelisted, while Node1 will be used for
|
# from peers which are not whitelisted, while Node1 will be used for
|
||||||
# the whitelisted case.
|
# the whitelisted case.
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir,
|
|
||||||
binary=self.options.testbinary))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
|
||||||
["-whitelist=127.0.0.1"],
|
|
||||||
binary=self.options.testbinary))
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Setup the p2p connections and start up the network thread.
|
# Setup the p2p connections and start up the network thread.
|
||||||
|
|
|
@ -98,17 +98,9 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
# Node0 = pre-segwit, node1 = segwit-aware
|
# Node0 = pre-segwit, node1 = segwit-aware
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
self.extra_args = [["-bip9params=segwit:0:0"], ["-txindex"]]
|
||||||
self.utxos = []
|
self.utxos = []
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
|
|
||||||
# Start up node0 to be a version 1, pre-segwit node.
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
[["-bip9params=segwit:0:0"],
|
|
||||||
["-txindex"]])
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
|
||||||
|
|
||||||
def build_block_on_tip(self, node, segwit=False):
|
def build_block_on_tip(self, node, segwit=False):
|
||||||
height = node.getblockcount()
|
height = node.getblockcount()
|
||||||
tip = node.getbestblockhash()
|
tip = node.getbestblockhash()
|
||||||
|
|
|
@ -43,14 +43,6 @@ class FeeFilterTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
# Node1 will be used to generate txs which should be relayed from Node0
|
|
||||||
# to our test node
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
node1 = self.nodes[1]
|
node1 = self.nodes[1]
|
||||||
node0 = self.nodes[0]
|
node0 = self.nodes[0]
|
||||||
|
|
|
@ -92,10 +92,7 @@ class P2PLeakTest(BitcoinTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
def setup_network(self):
|
self.extra_args = [['-banscore='+str(banscore)]]
|
||||||
extra_args = [['-banscore='+str(banscore)]
|
|
||||||
for i in range(self.num_nodes)]
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
no_version_bannode = CNodeNoVersionBan()
|
no_version_bannode = CNodeNoVersionBan()
|
||||||
|
|
|
@ -17,10 +17,8 @@ class P2PMempoolTests(BitcoinTestFramework):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 1
|
||||||
|
self.extra_args = [["-peerbloomfilters=0"]]
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = [start_node(0, self.options.tmpdir, ["-peerbloomfilters=0"])]
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
#connect a mininode
|
#connect a mininode
|
||||||
|
|
|
@ -124,17 +124,13 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
self.extra_args = [["-whitelist=127.0.0.1"], ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0"], ["-whitelist=127.0.0.1", "-bip9params=segwit:0:0"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-whitelist=127.0.0.1"]))
|
|
||||||
# Start a node for testing IsStandard rules.
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-whitelist=127.0.0.1", "-acceptnonstdtxn=0"]))
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
connect_nodes(self.nodes[0], 1)
|
||||||
|
|
||||||
# Disable segwit's bip9 parameter to simulate upgrading after activation.
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-whitelist=127.0.0.1", "-bip9params=segwit:0:0"]))
|
|
||||||
connect_nodes(self.nodes[0], 2)
|
connect_nodes(self.nodes[0], 2)
|
||||||
|
self.sync_all()
|
||||||
|
|
||||||
''' Helpers '''
|
''' Helpers '''
|
||||||
# Build a block on top of node0's tip.
|
# Build a block on top of node0's tip.
|
||||||
|
|
|
@ -38,12 +38,6 @@ class TimeoutsTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
|
|
||||||
# Start up node0 to be a version 1, pre-segwit node.
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# Setup the p2p connections and start up the network thread.
|
# Setup the p2p connections and start up the network thread.
|
||||||
self.no_verack_node = TestNode() # never send verack
|
self.no_verack_node = TestNode() # never send verack
|
||||||
|
|
|
@ -40,7 +40,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||||
with open(self.alert_filename, 'w', encoding='utf8') as _:
|
with open(self.alert_filename, 'w', encoding='utf8') as _:
|
||||||
pass
|
pass
|
||||||
self.extra_args = [["-alertnotify=echo %s >> \"" + self.alert_filename + "\""]]
|
self.extra_args = [["-alertnotify=echo %s >> \"" + self.alert_filename + "\""]]
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
|
self.setup_nodes()
|
||||||
|
|
||||||
# Send numblocks blocks via peer with nVersionToUse set.
|
# Send numblocks blocks via peer with nVersionToUse set.
|
||||||
def send_blocks_with_version(self, peer, numblocks, nVersionToUse):
|
def send_blocks_with_version(self, peer, numblocks, nVersionToUse):
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PreciousTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = self.setup_nodes()
|
self.setup_nodes()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Ensure submitblock can in principle reorg to a competing chain")
|
self.log.info("Ensure submitblock can in principle reorg to a competing chain")
|
||||||
|
|
|
@ -14,17 +14,12 @@ class PrioritiseTransactionTest(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 = [["-printpriority=1"]]
|
||||||
self.txouts = gen_return_txouts()
|
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-printpriority=1"]))
|
|
||||||
self.relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
self.txouts = gen_return_txouts()
|
||||||
|
self.relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||||
|
|
||||||
utxo_count = 90
|
utxo_count = 90
|
||||||
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], utxo_count)
|
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], utxo_count)
|
||||||
base_fee = self.relayfee*100 # our transactions are smaller than 100kb
|
base_fee = self.relayfee*100 # our transactions are smaller than 100kb
|
||||||
|
|
|
@ -90,7 +90,7 @@ class ProxyTest(BitcoinTestFramework):
|
||||||
]
|
]
|
||||||
if self.have_ipv6:
|
if self.have_ipv6:
|
||||||
args[3] = ['-listen', '-proxy=[%s]:%i' % (self.conf3.addr),'-proxyrandomize=0', '-noonion']
|
args[3] = ['-listen', '-proxy=[%s]:%i' % (self.conf3.addr),'-proxyrandomize=0', '-noonion']
|
||||||
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=args)
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=args)
|
||||||
|
|
||||||
def node_test(self, node, proxies, auth, test_onion=True):
|
def node_test(self, node, proxies, auth, test_onion=True):
|
||||||
rv = []
|
rv = []
|
||||||
|
|
|
@ -32,31 +32,21 @@ class PruneTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 6
|
self.num_nodes = 6
|
||||||
|
|
||||||
# Cache for utxos, as the listunspent may take a long time later in the test
|
# Create nodes 0 and 1 to mine.
|
||||||
self.utxo_cache_0 = []
|
# Create node 2 to test pruning.
|
||||||
self.utxo_cache_1 = []
|
# Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later)
|
||||||
|
# Create nodes 5 to test wallet in prune mode, but do not connect
|
||||||
|
self.extra_args = [["-maxreceivebuffer=20000", "-blockmaxsize=999000", "-checkblocks=5"],
|
||||||
|
["-maxreceivebuffer=20000", "-blockmaxsize=999000", "-checkblocks=5"],
|
||||||
|
["-maxreceivebuffer=20000", "-prune=550"],
|
||||||
|
["-maxreceivebuffer=20000", "-blockmaxsize=999000"],
|
||||||
|
["-maxreceivebuffer=20000", "-blockmaxsize=999000"],
|
||||||
|
["-prune=550"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
self.setup_nodes()
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
# Create nodes 0 and 1 to mine
|
self.prunedir = self.options.tmpdir + "/node2/regtest/blocks/"
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=999000", "-checkblocks=5"], timewait=900))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=999000", "-checkblocks=5"], timewait=900))
|
|
||||||
|
|
||||||
# Create node 2 to test pruning
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-maxreceivebuffer=20000","-prune=550"], timewait=900))
|
|
||||||
self.prunedir = self.options.tmpdir+"/node2/regtest/blocks/"
|
|
||||||
|
|
||||||
# Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later)
|
|
||||||
self.nodes.append(start_node(3, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=999000"], timewait=900))
|
|
||||||
self.nodes.append(start_node(4, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=999000"], timewait=900))
|
|
||||||
|
|
||||||
# Create nodes 5 to test wallet in prune mode, but do not connect
|
|
||||||
self.nodes.append(start_node(5, self.options.tmpdir, ["-prune=550"]))
|
|
||||||
|
|
||||||
# Determine default relay fee
|
|
||||||
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
|
|
||||||
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
connect_nodes(self.nodes[0], 1)
|
||||||
connect_nodes(self.nodes[1], 2)
|
connect_nodes(self.nodes[1], 2)
|
||||||
|
@ -332,6 +322,14 @@ class PruneTest(BitcoinTestFramework):
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Warning! This test requires 4GB of disk space and takes over 30 mins (up to 2 hours)")
|
self.log.info("Warning! This test requires 4GB of disk space and takes over 30 mins (up to 2 hours)")
|
||||||
self.log.info("Mining a big blockchain of 995 blocks")
|
self.log.info("Mining a big blockchain of 995 blocks")
|
||||||
|
|
||||||
|
# Determine default relay fee
|
||||||
|
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
|
||||||
|
|
||||||
|
# Cache for utxos, as the listunspent may take a long time later in the test
|
||||||
|
self.utxo_cache_0 = []
|
||||||
|
self.utxo_cache_1 = []
|
||||||
|
|
||||||
self.create_big_chain()
|
self.create_big_chain()
|
||||||
# Chain diagram key:
|
# Chain diagram key:
|
||||||
# * blocks on main chain
|
# * blocks on main chain
|
||||||
|
|
|
@ -24,21 +24,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self, split=False):
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
super().setup_network()
|
||||||
|
|
||||||
#connect to a local machine for debugging
|
|
||||||
#url = "http://bitcoinrpc:DP6DvqZtqXarpeNWyN3LZTFchCCyCUuHwNF7E8pX99x1@%s:%d" % ('127.0.0.1', 18332)
|
|
||||||
#proxy = AuthServiceProxy(url)
|
|
||||||
#proxy.url = url # store URL on proxy for info
|
|
||||||
#self.nodes.append(proxy)
|
|
||||||
|
|
||||||
connect_nodes_bi(self.nodes,0,1)
|
|
||||||
connect_nodes_bi(self.nodes,1,2)
|
|
||||||
connect_nodes_bi(self.nodes,0,2)
|
connect_nodes_bi(self.nodes,0,2)
|
||||||
|
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
#prepare some coins for multiple *rawtransaction commands
|
#prepare some coins for multiple *rawtransaction commands
|
||||||
|
|
|
@ -32,7 +32,7 @@ class ReceivedByTest(BitcoinTestFramework):
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
#This test requires mocktime
|
#This test requires mocktime
|
||||||
enable_mocktime()
|
enable_mocktime()
|
||||||
return start_nodes(self.num_nodes, self.options.tmpdir)
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -24,9 +24,6 @@ class ReindexTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
|
|
||||||
def reindex(self, justchainstate=False):
|
def reindex(self, justchainstate=False):
|
||||||
self.nodes[0].generate(3)
|
self.nodes[0].generate(3)
|
||||||
blockcount = self.nodes[0].getblockcount()
|
blockcount = self.nodes[0].getblockcount()
|
||||||
|
|
|
@ -65,17 +65,12 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
|
self.extra_args= [["-maxorphantx=1000",
|
||||||
def setup_network(self):
|
"-whitelist=127.0.0.1",
|
||||||
self.nodes = []
|
"-limitancestorcount=50",
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxorphantx=1000",
|
"-limitancestorsize=101",
|
||||||
"-whitelist=127.0.0.1",
|
"-limitdescendantcount=200",
|
||||||
"-limitancestorcount=50",
|
"-limitdescendantsize=101"]]
|
||||||
"-limitancestorsize=101",
|
|
||||||
"-limitdescendantcount=200",
|
|
||||||
"-limitdescendantsize=101"
|
|
||||||
]))
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
make_utxo(self.nodes[0], 1*COIN)
|
make_utxo(self.nodes[0], 1*COIN)
|
||||||
|
|
|
@ -49,12 +49,8 @@ class RESTTest (BitcoinTestFramework):
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self, split=False):
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
super().setup_network()
|
||||||
connect_nodes_bi(self.nodes,0,1)
|
connect_nodes_bi(self.nodes, 0, 2)
|
||||||
connect_nodes_bi(self.nodes,1,2)
|
|
||||||
connect_nodes_bi(self.nodes,0,2)
|
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
url = urllib.parse.urlparse(self.nodes[0].url)
|
url = urllib.parse.urlparse(self.nodes[0].url)
|
||||||
|
|
|
@ -22,11 +22,6 @@ class NamedArgumentTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
h = node.help(command='getinfo')
|
h = node.help(command='getinfo')
|
||||||
|
|
|
@ -80,16 +80,13 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
self.extra_args = [["-walletprematurewitness", "-rpcserialversion=0"],
|
||||||
|
["-blockversion=4", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness", "-rpcserialversion=1"],
|
||||||
|
["-blockversion=536870915", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness"]]
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = []
|
super().setup_network()
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-walletprematurewitness", "-rpcserialversion=0"]))
|
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-blockversion=4", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness", "-rpcserialversion=1"]))
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir, ["-blockversion=536870915", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness"]))
|
|
||||||
connect_nodes(self.nodes[1], 0)
|
|
||||||
connect_nodes(self.nodes[2], 1)
|
|
||||||
connect_nodes(self.nodes[0], 2)
|
connect_nodes(self.nodes[0], 2)
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def success_mine(self, node, txid, sign, redeem_script=""):
|
def success_mine(self, node, txid, sign, redeem_script=""):
|
||||||
|
|
|
@ -182,11 +182,6 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = []
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
connect_nodes(self.nodes[0], 1)
|
|
||||||
|
|
||||||
# mine count blocks and return the new tip
|
# mine count blocks and return the new tip
|
||||||
def mine_blocks(self, count):
|
def mine_blocks(self, count):
|
||||||
# Clear out last block announcement from each p2p listener
|
# Clear out last block announcement from each p2p listener
|
||||||
|
|
|
@ -14,10 +14,6 @@ class SignMessagesTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
message = 'This is just a test message'
|
message = 'This is just a test message'
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,6 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def successful_signing_test(self):
|
def successful_signing_test(self):
|
||||||
"""Create and sign a valid raw transaction with one input.
|
"""Create and sign a valid raw transaction with one input.
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,6 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
connect_nodes(self.nodes[0], 2)
|
connect_nodes(self.nodes[0], 2)
|
||||||
connect_nodes(self.nodes[2], 1)
|
connect_nodes(self.nodes[2], 1)
|
||||||
|
|
||||||
self.is_network_split = False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def transact_and_mine(self, numblocks, mining_node):
|
def transact_and_mine(self, numblocks, mining_node):
|
||||||
|
|
|
@ -17,6 +17,7 @@ from .util import (
|
||||||
initialize_chain,
|
initialize_chain,
|
||||||
start_nodes,
|
start_nodes,
|
||||||
connect_nodes_bi,
|
connect_nodes_bi,
|
||||||
|
disconnect_nodes,
|
||||||
sync_blocks,
|
sync_blocks,
|
||||||
sync_mempools,
|
sync_mempools,
|
||||||
stop_nodes,
|
stop_nodes,
|
||||||
|
@ -56,52 +57,42 @@ class BitcoinTestFramework(object):
|
||||||
stop_node(self.nodes[num_node], num_node)
|
stop_node(self.nodes[num_node], num_node)
|
||||||
|
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
return start_nodes(self.num_nodes, self.options.tmpdir)
|
extra_args = None
|
||||||
|
if hasattr(self, "extra_args"):
|
||||||
|
extra_args = self.extra_args
|
||||||
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
def setup_network(self):
|
||||||
self.nodes = self.setup_nodes()
|
self.setup_nodes()
|
||||||
|
|
||||||
# Connect the nodes as a "chain". This allows us
|
# Connect the nodes as a "chain". This allows us
|
||||||
# to split the network between nodes 1 and 2 to get
|
# to split the network between nodes 1 and 2 to get
|
||||||
# two halves that can work on competing chains.
|
# two halves that can work on competing chains.
|
||||||
|
for i in range(self.num_nodes - 1):
|
||||||
# If we joined network halves, connect the nodes from the joint
|
connect_nodes_bi(self.nodes, i, i + 1)
|
||||||
# on outward. This ensures that chains are properly reorganised.
|
|
||||||
if not split:
|
|
||||||
connect_nodes_bi(self.nodes, 1, 2)
|
|
||||||
sync_blocks(self.nodes[1:3])
|
|
||||||
sync_mempools(self.nodes[1:3])
|
|
||||||
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
|
||||||
connect_nodes_bi(self.nodes, 2, 3)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def split_network(self):
|
def split_network(self):
|
||||||
"""
|
"""
|
||||||
Split the network of four nodes into nodes 0/1 and 2/3.
|
Split the network of four nodes into nodes 0/1 and 2/3.
|
||||||
"""
|
"""
|
||||||
assert not self.is_network_split
|
disconnect_nodes(self.nodes[1], 2)
|
||||||
stop_nodes(self.nodes)
|
disconnect_nodes(self.nodes[2], 1)
|
||||||
self.setup_network(True)
|
self.sync_all([self.nodes[:2], self.nodes[2:]])
|
||||||
|
|
||||||
def sync_all(self):
|
def sync_all(self, node_groups=None):
|
||||||
if self.is_network_split:
|
if not node_groups:
|
||||||
sync_blocks(self.nodes[:2])
|
node_groups = [self.nodes]
|
||||||
sync_blocks(self.nodes[2:])
|
|
||||||
sync_mempools(self.nodes[:2])
|
[sync_blocks(group) for group in node_groups]
|
||||||
sync_mempools(self.nodes[2:])
|
[sync_mempools(group) for group in node_groups]
|
||||||
else:
|
|
||||||
sync_blocks(self.nodes)
|
|
||||||
sync_mempools(self.nodes)
|
|
||||||
|
|
||||||
def join_network(self):
|
def join_network(self):
|
||||||
"""
|
"""
|
||||||
Join the (previously split) network halves together.
|
Join the (previously split) network halves together.
|
||||||
"""
|
"""
|
||||||
assert self.is_network_split
|
connect_nodes_bi(self.nodes, 1, 2)
|
||||||
stop_nodes(self.nodes)
|
self.sync_all()
|
||||||
self.setup_network(False)
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
|
||||||
|
|
|
@ -315,7 +315,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
|
||||||
datadir = os.path.join(dirname, "node"+str(i))
|
datadir = os.path.join(dirname, "node"+str(i))
|
||||||
if binary is None:
|
if binary is None:
|
||||||
binary = os.getenv("BITCOIND", "bitcoind")
|
binary = os.getenv("BITCOIND", "bitcoind")
|
||||||
args = [binary, "-datadir=" + datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(get_mocktime())]
|
args = [binary, "-datadir=" + datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(get_mocktime()), "-uacomment=testnode%d" % i]
|
||||||
if extra_args is not None: args.extend(extra_args)
|
if extra_args is not None: args.extend(extra_args)
|
||||||
bitcoind_processes[i] = subprocess.Popen(args, stderr=stderr)
|
bitcoind_processes[i] = subprocess.Popen(args, stderr=stderr)
|
||||||
logger.debug("initialize_chain: bitcoind started, waiting for RPC to come up")
|
logger.debug("initialize_chain: bitcoind started, waiting for RPC to come up")
|
||||||
|
@ -354,6 +354,8 @@ def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, timewait=None
|
||||||
"""
|
"""
|
||||||
if extra_args is None: extra_args = [ None for _ in range(num_nodes) ]
|
if extra_args is None: extra_args = [ None for _ in range(num_nodes) ]
|
||||||
if binary is None: binary = [ None for _ in range(num_nodes) ]
|
if binary is None: binary = [ None for _ in range(num_nodes) ]
|
||||||
|
assert_equal(len(extra_args), num_nodes)
|
||||||
|
assert_equal(len(binary), num_nodes)
|
||||||
rpcs = []
|
rpcs = []
|
||||||
try:
|
try:
|
||||||
for i in range(num_nodes):
|
for i in range(num_nodes):
|
||||||
|
@ -385,6 +387,17 @@ def set_node_times(nodes, t):
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
node.setmocktime(t)
|
node.setmocktime(t)
|
||||||
|
|
||||||
|
def disconnect_nodes(from_connection, node_num):
|
||||||
|
for peer_id in [peer['id'] for peer in from_connection.getpeerinfo() if "testnode%d" % node_num in peer['subver']]:
|
||||||
|
from_connection.disconnectnode(nodeid=peer_id)
|
||||||
|
|
||||||
|
for _ in range(50):
|
||||||
|
if [peer['id'] for peer in from_connection.getpeerinfo() if "testnode%d" % node_num in peer['subver']] == []:
|
||||||
|
break
|
||||||
|
time.sleep(0.1)
|
||||||
|
else:
|
||||||
|
raise AssertionError("timed out waiting for disconnect")
|
||||||
|
|
||||||
def connect_nodes(from_connection, node_num):
|
def connect_nodes(from_connection, node_num):
|
||||||
ip_port = "127.0.0.1:"+str(p2p_port(node_num))
|
ip_port = "127.0.0.1:"+str(p2p_port(node_num))
|
||||||
from_connection.addnode(ip_port, "onetry")
|
from_connection.addnode(ip_port, "onetry")
|
||||||
|
|
|
@ -20,7 +20,9 @@ class TxnMallTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
# Start with split network:
|
# Start with split network:
|
||||||
return super(TxnMallTest, self).setup_network(True)
|
super(TxnMallTest, self).setup_network()
|
||||||
|
disconnect_nodes(self.nodes[1], 2)
|
||||||
|
disconnect_nodes(self.nodes[2], 1)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# All nodes should start with 1,250 BTC:
|
# All nodes should start with 1,250 BTC:
|
||||||
|
|
|
@ -20,7 +20,9 @@ class TxnMallTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
# Start with split network:
|
# Start with split network:
|
||||||
return super(TxnMallTest, self).setup_network(True)
|
super().setup_network()
|
||||||
|
disconnect_nodes(self.nodes[1], 2)
|
||||||
|
disconnect_nodes(self.nodes[2], 1)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# All nodes should start with 1,250 BTC:
|
# All nodes should start with 1,250 BTC:
|
||||||
|
|
|
@ -24,11 +24,7 @@ class WalletAccountsTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.node_args = [[]]
|
self.extra_args = [[]]
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.node_args)
|
|
||||||
self.is_network_split = False
|
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
|
|
|
@ -22,12 +22,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.node_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']]
|
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']]
|
||||||
|
|
||||||
def setup_network(self):
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.node_args)
|
|
||||||
self.is_network_split = False
|
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
tmpdir = self.options.tmpdir
|
tmpdir = self.options.tmpdir
|
||||||
|
@ -35,7 +30,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)
|
||||||
assert_start_raises_init_error(1, self.options.tmpdir, ['-usehd=0'], 'already existing HD wallet')
|
assert_start_raises_init_error(1, self.options.tmpdir, ['-usehd=0'], 'already existing HD wallet')
|
||||||
self.nodes[1] = start_node(1, self.options.tmpdir, self.node_args[1])
|
self.nodes[1] = start_node(1, self.options.tmpdir, self.extra_args[1])
|
||||||
connect_nodes_bi(self.nodes, 0, 1)
|
connect_nodes_bi(self.nodes, 0, 1)
|
||||||
|
|
||||||
# Make sure we use hd, keep masterkeyid
|
# Make sure we use hd, keep masterkeyid
|
||||||
|
@ -82,7 +77,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
os.remove(self.options.tmpdir + "/node1/regtest/wallet.dat")
|
os.remove(self.options.tmpdir + "/node1/regtest/wallet.dat")
|
||||||
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
|
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
|
||||||
self.nodes[1] = start_node(1, self.options.tmpdir, self.node_args[1])
|
self.nodes[1] = start_node(1, self.options.tmpdir, self.extra_args[1])
|
||||||
#connect_nodes_bi(self.nodes, 0, 1)
|
#connect_nodes_bi(self.nodes, 0, 1)
|
||||||
|
|
||||||
# Assert that derivation is deterministic
|
# Assert that derivation is deterministic
|
||||||
|
@ -96,7 +91,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.node_args[1] + ['-rescan'])
|
self.nodes[1] = start_node(1, self.options.tmpdir, self.extra_args[1] + ['-rescan'])
|
||||||
#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)
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,11 @@ class WalletTest(BitcoinTestFramework):
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
self.extra_args = [['-usehd={:d}'.format(i%2==0)] for i in range(4)]
|
self.extra_args = [['-usehd={:d}'.format(i%2==0)] for i in range(4)]
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self):
|
||||||
self.nodes = start_nodes(3, self.options.tmpdir, self.extra_args[:3])
|
self.nodes = start_nodes(3, self.options.tmpdir, self.extra_args[:3])
|
||||||
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)
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -44,14 +44,12 @@ class WalletBackupTest(BitcoinTestFramework):
|
||||||
# nodes 1, 2,3 are spenders, let's give them a keypool=100
|
# nodes 1, 2,3 are spenders, let's give them a keypool=100
|
||||||
self.extra_args = [["-keypool=100"], ["-keypool=100"], ["-keypool=100"], []]
|
self.extra_args = [["-keypool=100"], ["-keypool=100"], ["-keypool=100"], []]
|
||||||
|
|
||||||
# This mirrors how the network was setup in the bash test
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self, split=False):
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
|
self.setup_nodes()
|
||||||
connect_nodes(self.nodes[0], 3)
|
connect_nodes(self.nodes[0], 3)
|
||||||
connect_nodes(self.nodes[1], 3)
|
connect_nodes(self.nodes[1], 3)
|
||||||
connect_nodes(self.nodes[2], 3)
|
connect_nodes(self.nodes[2], 3)
|
||||||
connect_nodes(self.nodes[2], 0)
|
connect_nodes(self.nodes[2], 0)
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def one_send(self, from_node, to_address):
|
def one_send(self, from_node, to_address):
|
||||||
|
|
|
@ -23,13 +23,9 @@ class ZapWalletTXesTest (BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self):
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
super().setup_network()
|
||||||
connect_nodes_bi(self.nodes,0,1)
|
|
||||||
connect_nodes_bi(self.nodes,1,2)
|
|
||||||
connect_nodes_bi(self.nodes,0,2)
|
connect_nodes_bi(self.nodes,0,2)
|
||||||
self.is_network_split=False
|
|
||||||
self.sync_all()
|
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
self.log.info("Mining blocks...")
|
self.log.info("Mining blocks...")
|
||||||
|
|
|
@ -40,7 +40,7 @@ class ZMQTest (BitcoinTestFramework):
|
||||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
|
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
|
||||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
|
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
|
||||||
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % self.port)
|
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % self.port)
|
||||||
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[
|
||||||
['-zmqpubhashtx=tcp://127.0.0.1:'+str(self.port), '-zmqpubhashblock=tcp://127.0.0.1:'+str(self.port)],
|
['-zmqpubhashtx=tcp://127.0.0.1:'+str(self.port), '-zmqpubhashblock=tcp://127.0.0.1:'+str(self.port)],
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
|
|
Loading…
Reference in a new issue