aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-09-12 13:28:37 +0300
committerMarcoFalke <falke.marco@gmail.com>2019-09-12 13:28:49 +0300
commitca97d292ce60f672cc71610c9e2fb76f57d768fc (patch)
tree21d940dc87d98ae46c4b56511fff7c74e59f7469 /test/functional/test_framework
parent04d9939f460d6f6e08ef07d1c437013977cf9816 (diff)
parent333317ce6b67aa92f7363d48cd750712190b4b6b (diff)
downloadbitcoin-ca97d292ce60f672cc71610c9e2fb76f57d768fc.tar.xz
Merge #16551: test: Test that low difficulty chain fork is rejected
333317ce6b67aa92f7363d48cd750712190b4b6b test: Test that low difficulty chain fork is rejected (MarcoFalke) fa31dc1bf4ee471c4641eef8de02702ba0619ae7 test: Pass down correct chain name in tests (MarcoFalke) Pull request description: To prevent OOM, Bitcoin Core will reject chain forks at low difficulty by default. This is the only use-case of checkpoints, so add a test for it to make sure the feature works as expected. If it didn't work, checkpoints would have no use-case and we might as well remove them ACKs for top commit: Sjors: Thanks for adding the node 1 example. Code review ACK 333317c Tree-SHA512: 90dffa540d0904f3cffb61d2382b1a26f84fe9560b7013e4461546383add31a8757b350616a6d43217c59ef7b8b2a1b62bb3bab582c679cbb2c660a782ce7be1
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-xtest/functional/test_framework/mininode.py2
-rwxr-xr-xtest/functional/test_framework/test_node.py2
-rw-r--r--test/functional/test_framework/util.py12
3 files changed, 12 insertions, 4 deletions
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index 779863df79..166438cf70 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -111,7 +111,7 @@ class P2PConnection(asyncio.Protocol):
def is_connected(self):
return self._transport is not None
- def peer_connect(self, dstaddr, dstport, net="regtest"):
+ def peer_connect(self, dstaddr, dstport, *, net):
assert not self.is_connected
self.dstaddr = dstaddr
self.dstport = dstport
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 55e6d4caa6..d8bfdfd040 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -489,7 +489,7 @@ class TestNode():
if 'dstaddr' not in kwargs:
kwargs['dstaddr'] = '127.0.0.1'
- p2p_conn.peer_connect(**kwargs)()
+ p2p_conn.peer_connect(**kwargs, net=self.chain)()
self.p2ps.append(p2p_conn)
if wait_for_verack:
p2p_conn.wait_for_verack()
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index 6d74447ada..f9f5fe553e 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -287,14 +287,22 @@ def initialize_datadir(dirname, n, chain):
datadir = get_datadir_path(dirname, n)
if not os.path.isdir(datadir):
os.makedirs(datadir)
+ # Translate chain name to config name
+ if chain == 'testnet3':
+ chain_name_conf_arg = 'testnet'
+ chain_name_conf_section = 'test'
+ else:
+ chain_name_conf_arg = chain
+ chain_name_conf_section = chain
with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
- f.write("{}=1\n".format(chain))
- f.write("[{}]\n".format(chain))
+ f.write("{}=1\n".format(chain_name_conf_arg))
+ f.write("[{}]\n".format(chain_name_conf_section))
f.write("port=" + str(p2p_port(n)) + "\n")
f.write("rpcport=" + str(rpc_port(n)) + "\n")
f.write("server=1\n")
f.write("keypool=1\n")
f.write("discover=0\n")
+ f.write("dnsseed=0\n")
f.write("listenonion=0\n")
f.write("printtoconsole=0\n")
f.write("upnp=0\n")