diff options
-rw-r--r-- | doc/build-windows.md | 23 | ||||
-rwxr-xr-x | test/functional/maxuploadtarget.py | 5 | ||||
-rwxr-xr-x | test/functional/p2p-acceptblock.py | 4 | ||||
-rwxr-xr-x | test/functional/p2p-leaktests.py | 3 | ||||
-rwxr-xr-x | test/functional/p2p-segwit.py | 13 | ||||
-rwxr-xr-x | test/functional/test_framework/comptool.py | 2 | ||||
-rwxr-xr-x | test/functional/test_framework/mininode.py | 6 | ||||
-rwxr-xr-x | test/functional/test_framework/test_node.py | 17 |
8 files changed, 32 insertions, 41 deletions
diff --git a/doc/build-windows.md b/doc/build-windows.md index c415595e43..9e3e38d188 100644 --- a/doc/build-windows.md +++ b/doc/build-windows.md @@ -31,24 +31,19 @@ This feature is not supported in versions of Windows prior to Windows 10 or on Windows Server SKUs. In addition, it is available [only for 64-bit versions of Windows](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide). -For Windows 10 systems with the Fall Creators Update applied (version >= 16215.0) use the Windows Store -to install Ubuntu. Search for "Linux" in the Windows Store and install the free "Ubuntu" application. -Full instructions are available on the above link. +Full instructions to install WSL are available on the above link. +To install WSL on Windows 10 with Fall Creators Update installed (version >= 16215.0) do the following: -To get the bash shell, you must first activate the feature in Windows. - -1. Turn on Developer Mode - * Open Settings -> Update and Security -> For developers - * Select the Developer Mode radio button - * Restart if necessary -2. Enable the Windows Subsystem for Linux feature +1. Enable the Windows Subsystem for Linux feature * From Start, search for "Turn Windows features on or off" (type 'turn') - * Select Windows Subsystem for Linux (beta) + * Select Windows Subsystem for Linux * Click OK * Restart if necessary +2. Install Ubuntu + * Open Microsoft Store and search for Ubuntu or use [this link](https://www.microsoft.com/store/productId/9NBLGGH4MSV6) + * Click Install 3. Complete Installation - * Open a cmd prompt and type "bash" - * Accept the license + * Open a cmd prompt and type "Ubuntu" * Create a new UNIX user account (this is a separate account from your Windows account) After the bash shell is active, you can follow the instructions below, starting @@ -148,7 +143,7 @@ Footnotes causes two of the bitcoin executables to crash shortly after start up. The bug is related to the -fstack-protector-all g++ compiler flag which is used to mitigate buffer overflows. Installing the mingw-w64 packages from the Ubuntu 17 distribution solves the issue, however, this is not -an officially supported approach and it's only recommended if you are prepared to reinstall WSL/Ubutntu should +an officially supported approach and it's only recommended if you are prepared to reinstall WSL/Ubuntu should something break. <a name="footnote2">2</a>: Starting from Ubuntu Xenial 16.04 both the 32 and 64 bit mingw-w64 packages install two different diff --git a/test/functional/maxuploadtarget.py b/test/functional/maxuploadtarget.py index 9c92aa1dc0..88e2ff2e16 100755 --- a/test/functional/maxuploadtarget.py +++ b/test/functional/maxuploadtarget.py @@ -54,7 +54,7 @@ class MaxUploadTest(BitcoinTestFramework): # p2p_conns[2] will test resetting the counters p2p_conns = [] - for i in range(3): + for _ in range(3): p2p_conns.append(self.nodes[0].add_p2p_connection(TestNode())) NetworkThread().start() # Start up network handling in another thread @@ -139,8 +139,7 @@ class MaxUploadTest(BitcoinTestFramework): self.log.info("Peer 2 able to download old block") - for i in range(3): - self.nodes[0].disconnect_p2p() + self.nodes[0].disconnect_p2ps() #stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1 self.log.info("Restarting nodes with -whitelist=127.0.0.1") diff --git a/test/functional/p2p-acceptblock.py b/test/functional/p2p-acceptblock.py index fbe5a78029..ca0e0080a1 100755 --- a/test/functional/p2p-acceptblock.py +++ b/test/functional/p2p-acceptblock.py @@ -206,7 +206,7 @@ class AcceptBlockTest(BitcoinTestFramework): # The node should have requested the blocks at some point, so # disconnect/reconnect first - self.nodes[0].disconnect_p2p() + self.nodes[0].disconnect_p2ps() test_node = self.nodes[0].add_p2p_connection(NodeConnCB()) test_node.wait_for_verack() @@ -291,7 +291,7 @@ class AcceptBlockTest(BitcoinTestFramework): except AssertionError: test_node.wait_for_disconnect() - self.nodes[0].disconnect_p2p() + self.nodes[0].disconnect_p2ps() test_node = self.nodes[0].add_p2p_connection(NodeConnCB()) NetworkThread().start() # Start up network handling in another thread diff --git a/test/functional/p2p-leaktests.py b/test/functional/p2p-leaktests.py index a6e47b5df6..719a03914d 100755 --- a/test/functional/p2p-leaktests.py +++ b/test/functional/p2p-leaktests.py @@ -125,8 +125,7 @@ class P2PLeakTest(BitcoinTestFramework): assert not unsupported_service_bit5_node.connected assert not unsupported_service_bit7_node.connected - for _ in range(5): - self.nodes[0].disconnect_p2p() + self.nodes[0].disconnect_p2ps() # Wait until all connections are closed wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0) diff --git a/test/functional/p2p-segwit.py b/test/functional/p2p-segwit.py index 22da7f2db1..b940bc4096 100755 --- a/test/functional/p2p-segwit.py +++ b/test/functional/p2p-segwit.py @@ -32,9 +32,10 @@ def get_virtual_size(witness_block): return vsize class TestNode(NodeConnCB): - def __init__(self): + def __init__(self, rpc): super().__init__() self.getdataset = set() + self.rpc = rpc def on_getdata(self, conn, message): for inv in message.inv: @@ -73,7 +74,7 @@ class TestNode(NodeConnCB): tx_message = msg_witness_tx(tx) self.send_message(tx_message) self.sync_with_ping() - assert_equal(tx.hash in self.connection.rpc.getrawmempool(), accepted) + assert_equal(tx.hash in self.rpc.getrawmempool(), accepted) if (reason != None and not accepted): # Check the rejection reason as well. with mininode_lock: @@ -86,7 +87,7 @@ class TestNode(NodeConnCB): else: self.send_message(msg_block(block)) self.sync_with_ping() - assert_equal(self.connection.rpc.getbestblockhash() == block.hash, accepted) + assert_equal(self.rpc.getbestblockhash() == block.hash, accepted) # Used to keep track of anyone-can-spend outputs that we can use in the tests class UTXO(): @@ -1869,11 +1870,11 @@ class SegWitTest(BitcoinTestFramework): def run_test(self): # Setup the p2p connections and start up the network thread. # self.test_node sets NODE_WITNESS|NODE_NETWORK - self.test_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS) + self.test_node = self.nodes[0].add_p2p_connection(TestNode(self.nodes[0].rpc), services=NODE_NETWORK|NODE_WITNESS) # self.old_node sets only NODE_NETWORK - self.old_node = self.nodes[0].add_p2p_connection(TestNode(), services=NODE_NETWORK) + self.old_node = self.nodes[0].add_p2p_connection(TestNode(self.nodes[0].rpc), services=NODE_NETWORK) # self.std_node is for testing node1 (fRequireStandard=true) - self.std_node = self.nodes[1].add_p2p_connection(TestNode(), services=NODE_NETWORK|NODE_WITNESS) + self.std_node = self.nodes[1].add_p2p_connection(TestNode(self.nodes[1].rpc), services=NODE_NETWORK|NODE_WITNESS) NetworkThread().start() # Start up network handling in another thread diff --git a/test/functional/test_framework/comptool.py b/test/functional/test_framework/comptool.py index 03f967ba71..723826bae4 100755 --- a/test/functional/test_framework/comptool.py +++ b/test/functional/test_framework/comptool.py @@ -177,7 +177,7 @@ class TestManager(): # Create a p2p connection to each node test_node = TestNode(self.block_store, self.tx_store) self.test_nodes.append(test_node) - self.connections.append(NodeConn('127.0.0.1', p2p_port(i), nodes[i], test_node)) + self.connections.append(NodeConn('127.0.0.1', p2p_port(i), test_node)) # Make sure the TestNode (callback class) has a reference to its # associated NodeConn test_node.add_connection(self.connections[-1]) diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py index 8fbc63fba4..24ee09b81c 100755 --- a/test/functional/test_framework/mininode.py +++ b/test/functional/test_framework/mininode.py @@ -1420,7 +1420,6 @@ class NodeConnCB(): conn.send_message(msg_pong(message.nonce)) def on_verack(self, conn, message): - conn.ver_recv = conn.ver_send self.verack_received = True def on_version(self, conn, message): @@ -1516,7 +1515,7 @@ class NodeConn(asyncore.dispatcher): "regtest": b"\xfa\xbf\xb5\xda", # regtest } - def __init__(self, dstaddr, dstport, rpc, callback, net="regtest", services=NODE_NETWORK|NODE_WITNESS, send_version=True): + def __init__(self, dstaddr, dstport, callback, net="regtest", services=NODE_NETWORK|NODE_WITNESS, send_version=True): asyncore.dispatcher.__init__(self, map=mininode_socket_map) self.dstaddr = dstaddr self.dstport = dstport @@ -1524,8 +1523,6 @@ class NodeConn(asyncore.dispatcher): self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) self.sendbuf = b"" self.recvbuf = b"" - self.ver_send = 209 - self.ver_recv = 209 self.last_sent = 0 self.state = "connecting" self.network = net @@ -1549,7 +1546,6 @@ class NodeConn(asyncore.dispatcher): self.connect((dstaddr, dstport)) except: self.handle_close() - self.rpc = rpc def handle_connect(self): if self.state != "connected": diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 8b28064c46..34b458482a 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -168,7 +168,7 @@ class TestNode(): if 'dstaddr' not in kwargs: kwargs['dstaddr'] = '127.0.0.1' self.p2ps.append(p2p_conn) - kwargs.update({'rpc': self.rpc, 'callback': p2p_conn}) + kwargs.update({'callback': p2p_conn}) p2p_conn.add_connection(NodeConn(**kwargs)) return p2p_conn @@ -182,13 +182,14 @@ class TestNode(): assert self.p2ps, "No p2p connection" return self.p2ps[0] - def disconnect_p2p(self, index=0): - """Close the p2p connection to the node.""" - # Connection could have already been closed by other end. Calling disconnect_p2p() - # on an already disconnected p2p connection is not an error. - if self.p2ps[index].connection is not None: - self.p2ps[index].connection.disconnect_node() - del self.p2ps[index] + def disconnect_p2ps(self): + """Close all p2p connections to the node.""" + for p in self.p2ps: + # Connection could have already been closed by other end. + if p.connection is not None: + p.connection.disconnect_node() + self.p2ps = [] + class TestNodeCLI(): """Interface to bitcoin-cli for an individual node""" |