[tests] Functional tests call self.start_node(s) and self.stop_node(s)
This commit changes the individual test scripts to call the start_node(s) and stop_node(s) methods in BitcoinTestFramework.
This commit is contained in:
parent
c1c9a95379
commit
d8c218f9c2
30 changed files with 93 additions and 106 deletions
|
@ -73,8 +73,8 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
|
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
|
||||||
# TODO: redo with eviction
|
# TODO: redo with eviction
|
||||||
stop_node(self.nodes[0],0)
|
self.stop_node(0)
|
||||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
|
self.nodes[0] = self.start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
|
||||||
|
|
||||||
# Verify txs no longer in either node's mempool
|
# Verify txs no longer in either node's mempool
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
|
@ -100,8 +100,8 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
||||||
stop_node(self.nodes[0],0)
|
self.stop_node(0)
|
||||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.00001"])
|
self.nodes[0] = self.start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.00001"])
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
assert_equal(self.nodes[0].getbalance(), balance)
|
assert_equal(self.nodes[0].getbalance(), balance)
|
||||||
|
|
||||||
|
@ -120,8 +120,8 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
balance = newbalance
|
balance = newbalance
|
||||||
|
|
||||||
# Remove using high relay fee again
|
# Remove using high relay fee again
|
||||||
stop_node(self.nodes[0],0)
|
self.stop_node(0)
|
||||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
|
self.nodes[0] = self.start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
|
||||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||||
newbalance = self.nodes[0].getbalance()
|
newbalance = self.nodes[0].getbalance()
|
||||||
assert_equal(newbalance, balance - Decimal("24.9996"))
|
assert_equal(newbalance, balance - Decimal("24.9996"))
|
||||||
|
|
|
@ -45,7 +45,7 @@ from test_framework.mininode import (CBlockHeader,
|
||||||
msg_headers)
|
msg_headers)
|
||||||
from test_framework.script import (CScript, OP_TRUE)
|
from test_framework.script import (CScript, OP_TRUE)
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (start_node, p2p_port, assert_equal)
|
from test_framework.util import (p2p_port, assert_equal)
|
||||||
|
|
||||||
class BaseNode(NodeConnCB):
|
class BaseNode(NodeConnCB):
|
||||||
def send_header_for_blocks(self, new_blocks):
|
def send_header_for_blocks(self, new_blocks):
|
||||||
|
@ -63,7 +63,7 @@ class AssumeValidTest(BitcoinTestFramework):
|
||||||
# Start node0. We don't start the other nodes yet since
|
# Start node0. We don't start the other nodes yet since
|
||||||
# we need to pre-mine a block with an invalid transaction
|
# we need to pre-mine a block with an invalid transaction
|
||||||
# signature so we can pass in the block hash as assumevalid.
|
# signature so we can pass in the block hash as assumevalid.
|
||||||
self.nodes = [start_node(0, self.options.tmpdir)]
|
self.nodes = [self.start_node(0, self.options.tmpdir)]
|
||||||
|
|
||||||
def send_blocks_until_disconnected(self, node):
|
def send_blocks_until_disconnected(self, node):
|
||||||
"""Keep sending blocks to the node until we're disconnected."""
|
"""Keep sending blocks to the node until we're disconnected."""
|
||||||
|
@ -162,14 +162,14 @@ class AssumeValidTest(BitcoinTestFramework):
|
||||||
height += 1
|
height += 1
|
||||||
|
|
||||||
# Start node1 and node2 with assumevalid so they accept a block with a bad signature.
|
# Start node1 and node2 with assumevalid so they accept a block with a bad signature.
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
self.nodes.append(self.start_node(1, self.options.tmpdir,
|
||||||
["-assumevalid=" + hex(block102.sha256)]))
|
["-assumevalid=" + hex(block102.sha256)]))
|
||||||
node1 = BaseNode() # connects to node1
|
node1 = BaseNode() # connects to node1
|
||||||
connections.append(NodeConn('127.0.0.1', p2p_port(1), self.nodes[1], node1))
|
connections.append(NodeConn('127.0.0.1', p2p_port(1), self.nodes[1], node1))
|
||||||
node1.add_connection(connections[1])
|
node1.add_connection(connections[1])
|
||||||
node1.wait_for_verack()
|
node1.wait_for_verack()
|
||||||
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir,
|
self.nodes.append(self.start_node(2, self.options.tmpdir,
|
||||||
["-assumevalid=" + hex(block102.sha256)]))
|
["-assumevalid=" + hex(block102.sha256)]))
|
||||||
node2 = BaseNode() # connects to node2
|
node2 = BaseNode() # connects to node2
|
||||||
connections.append(NodeConn('127.0.0.1', p2p_port(2), self.nodes[2], node2))
|
connections.append(NodeConn('127.0.0.1', p2p_port(2), self.nodes[2], node2))
|
||||||
|
|
|
@ -239,7 +239,7 @@ class BIP9SoftForksTest(ComparisonTestFramework):
|
||||||
|
|
||||||
# Restart all
|
# Restart all
|
||||||
self.test.clear_all_connections()
|
self.test.clear_all_connections()
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
shutil.rmtree(self.options.tmpdir + "/node0")
|
shutil.rmtree(self.options.tmpdir + "/node0")
|
||||||
self.setup_chain()
|
self.setup_chain()
|
||||||
self.setup_network()
|
self.setup_network()
|
||||||
|
|
|
@ -24,6 +24,7 @@ from test_framework.util import (
|
||||||
assert_raises_jsonrpc,
|
assert_raises_jsonrpc,
|
||||||
assert_is_hex_string,
|
assert_is_hex_string,
|
||||||
assert_is_hash_string,
|
assert_is_hash_string,
|
||||||
|
connect_nodes_bi,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,12 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||||
def setup_network(self, split=False):
|
def setup_network(self, split=False):
|
||||||
extra_args = [["-prematurewitness", "-walletprematurewitness", "-walletrbf={}".format(i)]
|
extra_args = [["-prematurewitness", "-walletprematurewitness", "-walletrbf={}".format(i)]
|
||||||
for i in range(self.num_nodes)]
|
for i in range(self.num_nodes)]
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
||||||
|
|
||||||
# Encrypt wallet for test_locked_wallet_fails test
|
# Encrypt wallet for test_locked_wallet_fails test
|
||||||
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
|
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
|
||||||
bitcoind_processes[1].wait()
|
bitcoind_processes[1].wait()
|
||||||
self.nodes[1] = start_node(1, self.options.tmpdir, extra_args[1])
|
self.nodes[1] = self.start_node(1, self.options.tmpdir, extra_args[1])
|
||||||
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)
|
||||||
|
|
|
@ -9,10 +9,7 @@ from test_framework.mininode import wait_until
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (assert_equal,
|
from test_framework.util import (assert_equal,
|
||||||
assert_raises_jsonrpc,
|
assert_raises_jsonrpc,
|
||||||
connect_nodes_bi,
|
connect_nodes_bi)
|
||||||
start_node,
|
|
||||||
stop_node,
|
|
||||||
)
|
|
||||||
|
|
||||||
class DisconnectBanTest(BitcoinTestFramework):
|
class DisconnectBanTest(BitcoinTestFramework):
|
||||||
|
|
||||||
|
@ -68,9 +65,9 @@ class DisconnectBanTest(BitcoinTestFramework):
|
||||||
self.nodes[1].setmocktime(old_time + 3)
|
self.nodes[1].setmocktime(old_time + 3)
|
||||||
assert_equal(len(self.nodes[1].listbanned()), 3)
|
assert_equal(len(self.nodes[1].listbanned()), 3)
|
||||||
|
|
||||||
stop_node(self.nodes[1], 1)
|
self.stop_node(1)
|
||||||
|
|
||||||
self.nodes[1] = start_node(1, self.options.tmpdir)
|
self.nodes[1] = self.start_node(1, self.options.tmpdir)
|
||||||
listAfterShutdown = self.nodes[1].listbanned()
|
listAfterShutdown = self.nodes[1].listbanned()
|
||||||
assert_equal("127.0.0.0/24", listAfterShutdown[0]['address'])
|
assert_equal("127.0.0.0/24", listAfterShutdown[0]['address'])
|
||||||
assert_equal("127.0.0.0/32", listAfterShutdown[1]['address'])
|
assert_equal("127.0.0.0/32", listAfterShutdown[1]['address'])
|
||||||
|
|
|
@ -21,10 +21,10 @@ class ForkNotifyTest(BitcoinTestFramework):
|
||||||
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
|
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
|
||||||
with open(self.alert_filename, 'w', encoding='utf8'):
|
with open(self.alert_filename, 'w', encoding='utf8'):
|
||||||
pass # Just open then close to create zero-length file
|
pass # Just open then close to create zero-length file
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir,
|
self.nodes.append(self.start_node(0, self.options.tmpdir,
|
||||||
["-blockversion=2", "-alertnotify=echo %s >> \"" + self.alert_filename + "\""]))
|
["-blockversion=2", "-alertnotify=echo %s >> \"" + self.alert_filename + "\""]))
|
||||||
# Node1 mines block.version=211 blocks
|
# Node1 mines block.version=211 blocks
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
self.nodes.append(self.start_node(1, self.options.tmpdir,
|
||||||
["-blockversion=211"]))
|
["-blockversion=211"]))
|
||||||
connect_nodes(self.nodes[1], 0)
|
connect_nodes(self.nodes[1], 0)
|
||||||
|
|
||||||
|
|
|
@ -449,12 +449,12 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
############################################################
|
############################################################
|
||||||
# locked wallet test
|
# locked wallet test
|
||||||
self.nodes[1].encryptwallet("test")
|
self.nodes[1].encryptwallet("test")
|
||||||
|
self.stop_node(0)
|
||||||
|
self.stop_node(2)
|
||||||
|
self.stop_node(3)
|
||||||
self.nodes.pop(1)
|
self.nodes.pop(1)
|
||||||
stop_node(self.nodes[0], 0)
|
|
||||||
stop_node(self.nodes[1], 2)
|
|
||||||
stop_node(self.nodes[2], 3)
|
|
||||||
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir)
|
||||||
# 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:
|
||||||
|
|
|
@ -21,7 +21,7 @@ happened previously.
|
||||||
|
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (start_nodes, connect_nodes, sync_blocks, assert_equal, set_node_times)
|
from test_framework.util import (connect_nodes, sync_blocks, assert_equal, set_node_times)
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import enum
|
import enum
|
||||||
|
@ -121,7 +121,7 @@ class ImportRescanTest(BitcoinTestFramework):
|
||||||
if import_node.prune:
|
if import_node.prune:
|
||||||
extra_args[i] += ["-prune=1"]
|
extra_args[i] += ["-prune=1"]
|
||||||
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
@ -428,8 +428,8 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||||
|
|
||||||
|
|
||||||
# restart nodes to check for proper serialization/deserialization of watch only address
|
# restart nodes to check for proper serialization/deserialization of watch only address
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.nodes = start_nodes(2, self.options.tmpdir)
|
self.nodes = self.start_nodes(2, self.options.tmpdir)
|
||||||
address_assert = self.nodes[1].validateaddress(watchonly_address)
|
address_assert = self.nodes[1].validateaddress(watchonly_address)
|
||||||
assert_equal(address_assert['iswatchonly'], True)
|
assert_equal(address_assert['iswatchonly'], True)
|
||||||
assert_equal(address_assert['ismine'], False)
|
assert_equal(address_assert['ismine'], False)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||||
nodes[0].encryptwallet('test')
|
nodes[0].encryptwallet('test')
|
||||||
bitcoind_processes[0].wait()
|
bitcoind_processes[0].wait()
|
||||||
# Restart node 0
|
# Restart node 0
|
||||||
nodes[0] = start_node(0, self.options.tmpdir)
|
nodes[0] = self.start_node(0, self.options.tmpdir)
|
||||||
# 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)
|
||||||
|
|
|
@ -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()
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
self.nodes = self.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:
|
||||||
|
|
|
@ -146,8 +146,8 @@ class MaxUploadTest(BitcoinTestFramework):
|
||||||
|
|
||||||
#stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1
|
#stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1
|
||||||
self.log.info("Restarting nodes with -whitelist=127.0.0.1")
|
self.log.info("Restarting nodes with -whitelist=127.0.0.1")
|
||||||
stop_node(self.nodes[0], 0)
|
self.stop_node(0)
|
||||||
self.nodes[0] = start_node(0, self.options.tmpdir, ["-whitelist=127.0.0.1", "-maxuploadtarget=1", "-blockmaxsize=999000"])
|
self.nodes[0] = self.start_node(0, self.options.tmpdir, ["-whitelist=127.0.0.1", "-maxuploadtarget=1", "-blockmaxsize=999000"])
|
||||||
|
|
||||||
#recreate/reconnect a test node
|
#recreate/reconnect a test node
|
||||||
test_nodes = [TestNode()]
|
test_nodes = [TestNode()]
|
||||||
|
|
|
@ -63,27 +63,27 @@ class MempoolPersistTest(BitcoinTestFramework):
|
||||||
assert_equal(len(self.nodes[1].getrawmempool()), 5)
|
assert_equal(len(self.nodes[1].getrawmempool()), 5)
|
||||||
|
|
||||||
self.log.debug("Stop-start node0 and node1. Verify that node0 has the transactions in its mempool and node1 does not.")
|
self.log.debug("Stop-start node0 and node1. Verify that node0 has the transactions in its mempool and node1 does not.")
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
self.nodes.append(self.start_node(0, self.options.tmpdir))
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir))
|
self.nodes.append(self.start_node(1, self.options.tmpdir))
|
||||||
# Give bitcoind a second to reload the mempool
|
# Give bitcoind 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)
|
||||||
|
|
||||||
self.log.debug("Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.")
|
self.log.debug("Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.")
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-persistmempool=0"]))
|
self.nodes.append(self.start_node(0, self.options.tmpdir, ["-persistmempool=0"]))
|
||||||
# Give bitcoind a second to reload the mempool
|
# Give bitcoind 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)
|
||||||
|
|
||||||
self.log.debug("Stop-start node0. Verify that it has the transactions in its mempool.")
|
self.log.debug("Stop-start node0. Verify that it has the transactions in its mempool.")
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir))
|
self.nodes.append(self.start_node(0, self.options.tmpdir))
|
||||||
assert wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
|
assert wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -14,8 +14,7 @@ from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
assert_raises_jsonrpc,
|
assert_raises_jsonrpc,
|
||||||
connect_nodes_bi,
|
connect_nodes_bi,
|
||||||
p2p_port,
|
p2p_port)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class NetTest(BitcoinTestFramework):
|
class NetTest(BitcoinTestFramework):
|
||||||
|
|
|
@ -1495,8 +1495,8 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
|
|
||||||
# Restart with the new binary
|
# Restart with the new binary
|
||||||
stop_node(node, node_id)
|
self.stop_node(node_id)
|
||||||
self.nodes[node_id] = start_node(node_id, self.options.tmpdir)
|
self.nodes[node_id] = self.start_node(node_id, self.options.tmpdir)
|
||||||
connect_nodes(self.nodes[0], node_id)
|
connect_nodes(self.nodes[0], node_id)
|
||||||
|
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
|
|
|
@ -108,22 +108,22 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||||
# is cleared, and restart the node. This should move the versionbit state
|
# is cleared, and restart the node. This should move the versionbit state
|
||||||
# to ACTIVE.
|
# to ACTIVE.
|
||||||
self.nodes[0].generate(VB_PERIOD)
|
self.nodes[0].generate(VB_PERIOD)
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
# Empty out the alert file
|
# Empty out the alert file
|
||||||
with open(self.alert_filename, 'w', encoding='utf8') as _:
|
with open(self.alert_filename, 'w', encoding='utf8') as _:
|
||||||
pass
|
pass
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
|
||||||
|
|
||||||
# Connecting one block should be enough to generate an error.
|
# Connecting one block should be enough to generate an error.
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getinfo()["errors"])
|
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getinfo()["errors"])
|
||||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["errors"])
|
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["errors"])
|
||||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"])
|
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"])
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.test_versionbits_in_alert_file()
|
self.test_versionbits_in_alert_file()
|
||||||
|
|
||||||
# Test framework expects the node to still be running...
|
# Test framework expects the node to still be running...
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
VersionBitsWarningTest().main()
|
VersionBitsWarningTest().main()
|
||||||
|
|
|
@ -35,7 +35,6 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
PORT_MIN,
|
PORT_MIN,
|
||||||
PORT_RANGE,
|
PORT_RANGE,
|
||||||
start_nodes,
|
|
||||||
assert_equal,
|
assert_equal,
|
||||||
)
|
)
|
||||||
from test_framework.netutil import test_ipv6_local
|
from test_framework.netutil import test_ipv6_local
|
||||||
|
@ -90,7 +89,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']
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=args)
|
self.nodes = self.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 = []
|
||||||
|
|
|
@ -98,7 +98,7 @@ class PruneTest(BitcoinTestFramework):
|
||||||
# Node 2 stays connected, so it hears about the stale blocks and then reorg's when node0 reconnects
|
# Node 2 stays connected, so it hears about the stale blocks and then reorg's when node0 reconnects
|
||||||
# Stopping node 0 also clears its mempool, so it doesn't have node1's transactions to accidentally mine
|
# Stopping node 0 also clears its mempool, so it doesn't have node1's transactions to accidentally mine
|
||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
self.nodes[0]=start_node(0, self.options.tmpdir, self.full_node_default_args, timewait=900)
|
self.nodes[0]=self.start_node(0, self.options.tmpdir, self.full_node_default_args, timewait=900)
|
||||||
# Mine 24 blocks in node 1
|
# Mine 24 blocks in node 1
|
||||||
for i in range(24):
|
for i in range(24):
|
||||||
if j == 0:
|
if j == 0:
|
||||||
|
@ -126,7 +126,7 @@ class PruneTest(BitcoinTestFramework):
|
||||||
# Reboot node 1 to clear its mempool (hopefully make the invalidate faster)
|
# Reboot node 1 to clear its mempool (hopefully make the invalidate faster)
|
||||||
# Lower the block max size so we don't keep mining all our big mempool transactions (from disconnected blocks)
|
# Lower the block max size so we don't keep mining all our big mempool transactions (from disconnected blocks)
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
self.nodes[1]=start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900)
|
self.nodes[1] = self.start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900)
|
||||||
|
|
||||||
height = self.nodes[1].getblockcount()
|
height = self.nodes[1].getblockcount()
|
||||||
self.log.info("Current block height: %d" % height)
|
self.log.info("Current block height: %d" % height)
|
||||||
|
@ -149,7 +149,7 @@ class PruneTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Reboot node1 to clear those giant tx's from mempool
|
# Reboot node1 to clear those giant tx's from mempool
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
self.nodes[1]=start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900)
|
self.nodes[1] = self.start_node(1, self.options.tmpdir, ["-maxreceivebuffer=20000","-blockmaxsize=5000", "-checkblocks=5", "-disablesafemode"], timewait=900)
|
||||||
|
|
||||||
self.log.info("Generating new longer chain of 300 more blocks")
|
self.log.info("Generating new longer chain of 300 more blocks")
|
||||||
self.nodes[1].generate(300)
|
self.nodes[1].generate(300)
|
||||||
|
@ -227,13 +227,13 @@ 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
|
||||||
node = self.nodes[node_number] = start_node(node_number, self.options.tmpdir, timewait=900)
|
node = self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, timewait=900)
|
||||||
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)
|
||||||
self.stop_node(node_number)
|
self.stop_node(node_number)
|
||||||
|
|
||||||
# now re-start in manual pruning mode
|
# now re-start in manual pruning mode
|
||||||
node = self.nodes[node_number] = start_node(node_number, self.options.tmpdir, ["-prune=1"], timewait=900)
|
node = self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, ["-prune=1"], timewait=900)
|
||||||
assert_equal(node.getblockcount(), 995)
|
assert_equal(node.getblockcount(), 995)
|
||||||
|
|
||||||
def height(index):
|
def height(index):
|
||||||
|
@ -307,7 +307,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.nodes[node_number] = start_node(node_number, self.options.tmpdir, ["-prune=550"], timewait=900)
|
self.nodes[node_number] = self.start_node(node_number, self.options.tmpdir, ["-prune=550"], timewait=900)
|
||||||
|
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
|
@ -315,7 +315,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)
|
||||||
start_node(2, self.options.tmpdir, ["-prune=550"])
|
self.start_node(2, self.options.tmpdir, ["-prune=550"])
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
# check that wallet loads loads successfully when restarting a pruned node after IBD.
|
# check that wallet loads loads successfully when restarting a pruned node after IBD.
|
||||||
|
@ -325,7 +325,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
|
||||||
start_node(5, self.options.tmpdir, ["-prune=550"])
|
self.start_node(5, self.options.tmpdir, ["-prune=550"])
|
||||||
self.log.info("Success")
|
self.log.info("Success")
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
|
@ -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()
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -10,11 +10,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import assert_equal
|
||||||
start_nodes,
|
|
||||||
stop_nodes,
|
|
||||||
assert_equal,
|
|
||||||
)
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class ReindexTest(BitcoinTestFramework):
|
class ReindexTest(BitcoinTestFramework):
|
||||||
|
@ -27,9 +23,9 @@ class ReindexTest(BitcoinTestFramework):
|
||||||
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()
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
extra_args = [["-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]]
|
extra_args = [["-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]]
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
|
||||||
while self.nodes[0].getblockcount() < blockcount:
|
while self.nodes[0].getblockcount() < blockcount:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
assert_equal(self.nodes[0].getblockcount(), blockcount)
|
assert_equal(self.nodes[0].getblockcount(), blockcount)
|
||||||
|
|
|
@ -36,10 +36,10 @@ class RPCBindTest(BitcoinTestFramework):
|
||||||
if allow_ips:
|
if allow_ips:
|
||||||
base_args += ['-rpcallowip=' + x for x in allow_ips]
|
base_args += ['-rpcallowip=' + x for x in allow_ips]
|
||||||
binds = ['-rpcbind='+addr for addr in addresses]
|
binds = ['-rpcbind='+addr for addr in addresses]
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [base_args + binds], connect_to)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, [base_args + binds], connect_to)
|
||||||
pid = bitcoind_processes[0].pid
|
pid = bitcoind_processes[0].pid
|
||||||
assert_equal(set(get_bind_addrs(pid)), set(expected))
|
assert_equal(set(get_bind_addrs(pid)), set(expected))
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
|
|
||||||
def run_allowip_test(self, allow_ips, rpchost, rpcport):
|
def run_allowip_test(self, allow_ips, rpchost, rpcport):
|
||||||
'''
|
'''
|
||||||
|
@ -47,11 +47,11 @@ class RPCBindTest(BitcoinTestFramework):
|
||||||
at a non-localhost IP.
|
at a non-localhost IP.
|
||||||
'''
|
'''
|
||||||
base_args = ['-disablewallet', '-nolisten'] + ['-rpcallowip='+x for x in allow_ips]
|
base_args = ['-disablewallet', '-nolisten'] + ['-rpcallowip='+x for x in allow_ips]
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [base_args])
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, [base_args])
|
||||||
# connect to node through non-loopback interface
|
# connect to node through non-loopback interface
|
||||||
node = get_rpc_proxy(rpc_url(0, "%s:%d" % (rpchost, rpcport)), 0)
|
node = get_rpc_proxy(rpc_url(0, "%s:%d" % (rpchost, rpcport)), 0)
|
||||||
node.getnetworkinfo()
|
node.getnetworkinfo()
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
# due to OS-specific network stats queries, this test works only on Linux
|
# due to OS-specific network stats queries, this test works only on Linux
|
||||||
|
|
|
@ -155,7 +155,7 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
"""
|
"""
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
# Use node0 to mine blocks for input splitting
|
# Use node0 to mine blocks for input splitting
|
||||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxorphantx=1000",
|
self.nodes.append(self.start_node(0, self.options.tmpdir, ["-maxorphantx=1000",
|
||||||
"-whitelist=127.0.0.1"]))
|
"-whitelist=127.0.0.1"]))
|
||||||
|
|
||||||
self.log.info("This test is time consuming, please be patient")
|
self.log.info("This test is time consuming, please be patient")
|
||||||
|
@ -191,7 +191,7 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
# Node1 mines small blocks but that are bigger than the expected transaction rate.
|
# Node1 mines small blocks but that are bigger than the expected transaction rate.
|
||||||
# NOTE: the CreateNewBlock code starts counting block size at 1,000 bytes,
|
# NOTE: the CreateNewBlock code starts counting block size at 1,000 bytes,
|
||||||
# (17k is room enough for 110 or so transactions)
|
# (17k is room enough for 110 or so transactions)
|
||||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
self.nodes.append(self.start_node(1, self.options.tmpdir,
|
||||||
["-blockmaxsize=17000", "-maxorphantx=1000"]))
|
["-blockmaxsize=17000", "-maxorphantx=1000"]))
|
||||||
connect_nodes(self.nodes[1], 0)
|
connect_nodes(self.nodes[1], 0)
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class EstimateFeeTest(BitcoinTestFramework):
|
||||||
# produces too small blocks (room for only 55 or so transactions)
|
# produces too small blocks (room for only 55 or so transactions)
|
||||||
node2args = ["-blockmaxsize=8000", "-maxorphantx=1000"]
|
node2args = ["-blockmaxsize=8000", "-maxorphantx=1000"]
|
||||||
|
|
||||||
self.nodes.append(start_node(2, self.options.tmpdir, node2args))
|
self.nodes.append(self.start_node(2, self.options.tmpdir, node2args))
|
||||||
connect_nodes(self.nodes[0], 2)
|
connect_nodes(self.nodes[0], 2)
|
||||||
connect_nodes(self.nodes[2], 1)
|
connect_nodes(self.nodes[2], 1)
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,7 @@ RPCs tested are:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import assert_equal
|
||||||
assert_equal,
|
|
||||||
)
|
|
||||||
|
|
||||||
class WalletAccountsTest(BitcoinTestFramework):
|
class WalletAccountsTest(BitcoinTestFramework):
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"""Test the dumpwallet RPC."""
|
"""Test the dumpwallet RPC."""
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (start_nodes, start_node, assert_equal, bitcoind_processes)
|
from test_framework.util import (assert_equal, bitcoind_processes)
|
||||||
|
|
||||||
|
|
||||||
def read_dump(file_name, addrs, hd_master_addr_old):
|
def read_dump(file_name, addrs, hd_master_addr_old):
|
||||||
|
@ -66,7 +66,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.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args, timewait=60)
|
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args, timewait=60)
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
tmpdir = self.options.tmpdir
|
tmpdir = self.options.tmpdir
|
||||||
|
@ -93,7 +93,7 @@ class WalletDumpTest(BitcoinTestFramework):
|
||||||
#encrypt wallet, restart, unlock and dump
|
#encrypt wallet, restart, unlock and dump
|
||||||
self.nodes[0].encryptwallet('test')
|
self.nodes[0].encryptwallet('test')
|
||||||
bitcoind_processes[0].wait()
|
bitcoind_processes[0].wait()
|
||||||
self.nodes[0] = start_node(0, self.options.tmpdir, self.extra_args[0])
|
self.nodes[0] = self.start_node(0, self.options.tmpdir, self.extra_args[0])
|
||||||
self.nodes[0].walletpassphrase('test', 10)
|
self.nodes[0].walletpassphrase('test', 10)
|
||||||
# Should be a no-op:
|
# Should be a no-op:
|
||||||
self.nodes[0].keypoolrefill()
|
self.nodes[0].keypoolrefill()
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
start_node,
|
|
||||||
assert_equal,
|
assert_equal,
|
||||||
connect_nodes_bi,
|
connect_nodes_bi,
|
||||||
assert_start_raises_init_error
|
assert_start_raises_init_error
|
||||||
|
@ -29,7 +28,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.extra_args[1])
|
self.nodes[1] = self.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
|
||||||
|
@ -76,7 +75,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.extra_args[1])
|
self.nodes[1] = self.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
|
||||||
|
@ -90,7 +89,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] = self.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)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
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):
|
def setup_network(self):
|
||||||
self.nodes = start_nodes(3, self.options.tmpdir, self.extra_args[:3])
|
self.nodes = self.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)
|
||||||
|
@ -178,7 +178,7 @@ class WalletTest(BitcoinTestFramework):
|
||||||
txid2 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
txid2 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
||||||
sync_mempools(self.nodes)
|
sync_mempools(self.nodes)
|
||||||
|
|
||||||
self.nodes.append(start_node(3, self.options.tmpdir, self.extra_args[3]))
|
self.nodes.append(self.start_node(3, self.options.tmpdir, self.extra_args[3]))
|
||||||
connect_nodes_bi(self.nodes, 0, 3)
|
connect_nodes_bi(self.nodes, 0, 3)
|
||||||
sync_blocks(self.nodes)
|
sync_blocks(self.nodes)
|
||||||
|
|
||||||
|
@ -221,8 +221,8 @@ class WalletTest(BitcoinTestFramework):
|
||||||
assert(found)
|
assert(found)
|
||||||
|
|
||||||
#do some -walletbroadcast tests
|
#do some -walletbroadcast tests
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.nodes = start_nodes(3, self.options.tmpdir, [["-walletbroadcast=0"],["-walletbroadcast=0"],["-walletbroadcast=0"]])
|
self.nodes = self.start_nodes(3, self.options.tmpdir, [["-walletbroadcast=0"],["-walletbroadcast=0"],["-walletbroadcast=0"]])
|
||||||
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)
|
||||||
|
@ -246,8 +246,8 @@ class WalletTest(BitcoinTestFramework):
|
||||||
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
|
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
|
||||||
|
|
||||||
#restart the nodes with -walletbroadcast=1
|
#restart the nodes with -walletbroadcast=1
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
self.nodes = start_nodes(3, self.options.tmpdir)
|
self.nodes = self.start_nodes(3, self.options.tmpdir)
|
||||||
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)
|
||||||
|
@ -348,9 +348,9 @@ class WalletTest(BitcoinTestFramework):
|
||||||
chainlimit = 6
|
chainlimit = 6
|
||||||
for m in maintenance:
|
for m in maintenance:
|
||||||
self.log.info("check " + m)
|
self.log.info("check " + m)
|
||||||
stop_nodes(self.nodes)
|
self.stop_nodes()
|
||||||
# set lower ancestor limit for later
|
# set lower ancestor limit for later
|
||||||
self.nodes = start_nodes(3, self.options.tmpdir, [[m, "-limitancestorcount="+str(chainlimit)]] * 3)
|
self.nodes = self.start_nodes(3, self.options.tmpdir, [[m, "-limitancestorcount="+str(chainlimit)]] * 3)
|
||||||
while m == '-reindex' and [block_count] * 3 != [self.nodes[i].getblockcount() for i in range(3)]:
|
while m == '-reindex' and [block_count] * 3 != [self.nodes[i].getblockcount() for i in range(3)]:
|
||||||
# reindex will leave rpc warm up "early"; Wait for it to finish
|
# reindex will leave rpc warm up "early"; Wait for it to finish
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
@ -397,8 +397,8 @@ class WalletTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Try with walletrejectlongchains
|
# Try with walletrejectlongchains
|
||||||
# Double chain limit but require combining inputs, so we pass SelectCoinsMinConf
|
# Double chain limit but require combining inputs, so we pass SelectCoinsMinConf
|
||||||
stop_node(self.nodes[0],0)
|
self.stop_node(0)
|
||||||
self.nodes[0] = start_node(0, self.options.tmpdir, ["-walletrejectlongchains", "-limitancestorcount="+str(2*chainlimit)])
|
self.nodes[0] = self.start_node(0, self.options.tmpdir, ["-walletrejectlongchains", "-limitancestorcount="+str(2*chainlimit)])
|
||||||
|
|
||||||
# wait for loadmempool
|
# wait for loadmempool
|
||||||
timeout = 10
|
timeout = 10
|
||||||
|
|
|
@ -77,18 +77,18 @@ class WalletBackupTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# As above, this mirrors the original bash test.
|
# As above, this mirrors the original bash test.
|
||||||
def start_three(self):
|
def start_three(self):
|
||||||
self.nodes[0] = start_node(0, self.options.tmpdir)
|
self.nodes[0] = self.start_node(0, self.options.tmpdir)
|
||||||
self.nodes[1] = start_node(1, self.options.tmpdir)
|
self.nodes[1] = self.start_node(1, self.options.tmpdir)
|
||||||
self.nodes[2] = start_node(2, self.options.tmpdir)
|
self.nodes[2] = self.start_node(2, self.options.tmpdir)
|
||||||
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)
|
||||||
|
|
||||||
def stop_three(self):
|
def stop_three(self):
|
||||||
stop_node(self.nodes[0], 0)
|
self.stop_node(0)
|
||||||
stop_node(self.nodes[1], 1)
|
self.stop_node(1)
|
||||||
stop_node(self.nodes[2], 2)
|
self.stop_node(2)
|
||||||
|
|
||||||
def erase_three(self):
|
def erase_three(self):
|
||||||
os.remove(self.options.tmpdir + "/node0/regtest/wallet.dat")
|
os.remove(self.options.tmpdir + "/node0/regtest/wallet.dat")
|
||||||
|
|
|
@ -58,18 +58,16 @@ class ZapWalletTXesTest (BitcoinTestFramework):
|
||||||
assert_equal(tx3['txid'], txid3) #tx3 must be available (unconfirmed)
|
assert_equal(tx3['txid'], txid3) #tx3 must be available (unconfirmed)
|
||||||
|
|
||||||
#restart bitcoind
|
#restart bitcoind
|
||||||
self.nodes[0].stop()
|
self.stop_node(0)
|
||||||
bitcoind_processes[0].wait()
|
self.nodes[0] = self.start_node(0,self.options.tmpdir)
|
||||||
self.nodes[0] = start_node(0,self.options.tmpdir)
|
|
||||||
|
|
||||||
tx3 = self.nodes[0].gettransaction(txid3)
|
tx3 = self.nodes[0].gettransaction(txid3)
|
||||||
assert_equal(tx3['txid'], txid3) #tx must be available (unconfirmed)
|
assert_equal(tx3['txid'], txid3) #tx must be available (unconfirmed)
|
||||||
|
|
||||||
self.nodes[0].stop()
|
self.stop_node(0)
|
||||||
bitcoind_processes[0].wait()
|
|
||||||
|
|
||||||
#restart bitcoind with zapwallettxes
|
#restart bitcoind with zapwallettxes
|
||||||
self.nodes[0] = start_node(0,self.options.tmpdir, ["-zapwallettxes=1"])
|
self.nodes[0] = self.start_node(0,self.options.tmpdir, ["-zapwallettxes=1"])
|
||||||
|
|
||||||
assert_raises(JSONRPCException, self.nodes[0].gettransaction, [txid3])
|
assert_raises(JSONRPCException, self.nodes[0].gettransaction, [txid3])
|
||||||
#there must be a expection because the unconfirmed wallettx0 must be gone by now
|
#there must be a expection because the unconfirmed wallettx0 must be gone by now
|
||||||
|
|
|
@ -42,7 +42,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)
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[
|
self.nodes = self.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