Merge #11677: qa: Remove unused NodeConn members

fafdad0d4 qa: Remove unused NodeConn members (MarcoFalke)

Pull request description:

  * `ver_send` and `ver_recv` were completely unused
  * `rpc` was only used once, in p2p-segwit. Imo better only pass it to the constructor in that single test

Tree-SHA512: 7f85554d6d0fd2096516ca3c608811d5370da66cde35d8031bdc921607a7a4efdb26355896012f75f713f8df09e28d46ba46be69fd96a5898fabb1a25cbcb8ad
This commit is contained in:
MarcoFalke
2017-11-14 17:44:01 -05:00
4 changed files with 10 additions and 13 deletions

View File

@@ -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])

View File

@@ -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":

View File

@@ -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