aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-11-30 17:58:58 -0500
committerMarcoFalke <falke.marco@gmail.com>2017-11-30 18:01:51 -0500
commit13e31dd6548d64a5992f439e74bb424bf88aca04 (patch)
treee6ffed59782502920d90a4189be727f5cf6ad239 /test/functional/test_framework
parentfbce66a982679b5409a295be5c99a2eef429cabf (diff)
parent873beca6deda119077f53921f0d19c3ebfc7cc44 (diff)
downloadbitcoin-13e31dd6548d64a5992f439e74bb424bf88aca04.tar.xz
Merge #11791: [tests] Rename NodeConn and NodeConnCB
873beca6d [tests] Rename NodeConn and NodeConnCB (John Newbery) Pull request description: Final step in #11518 NodeConn -> P2PConnection NodeConnCB -> P2PInterface This is basically just a rename. Should be an easy review. Tree-SHA512: fe1204b2b3d8182c5e324ffa7cb4099a47ef8536380e0bb9d37a5fccf76a24f548d1f1a7988ab8f830986a3058b670696de3fc891af5e5f75dbeb4e3273005d7
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-xtest/functional/test_framework/comptool.py2
-rwxr-xr-xtest/functional/test_framework/mininode.py22
2 files changed, 9 insertions, 15 deletions
diff --git a/test/functional/test_framework/comptool.py b/test/functional/test_framework/comptool.py
index 2f64fba753..f0f5c847ca 100755
--- a/test/functional/test_framework/comptool.py
+++ b/test/functional/test_framework/comptool.py
@@ -39,7 +39,7 @@ class RejectResult():
def __repr__(self):
return '%i:%s' % (self.code,self.reason or '*')
-class TestNode(NodeConnCB):
+class TestNode(P2PInterface):
def __init__(self, block_store, tx_store):
super().__init__()
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index c580d99c79..9e92a70da1 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -9,10 +9,8 @@
This python code was modified from ArtForz' public domain half-a-node, as
found in the mini-node branch of http://github.com/jgarzik/pynode.
-NodeConn: an object which manages p2p connectivity to a bitcoin node
-NodeConnCB: a base class that describes the interface for receiving
- callbacks with network messages from a NodeConn
-"""
+P2PConnection: A low-level connection object to a node's P2P interface
+P2PInterface: A high-level interface object for communicating to a node over P2P"""
import asyncore
from collections import defaultdict
from io import BytesIO
@@ -57,7 +55,7 @@ MAGIC_BYTES = {
"regtest": b"\xfa\xbf\xb5\xda", # regtest
}
-class NodeConn(asyncore.dispatcher):
+class P2PConnection(asyncore.dispatcher):
"""A low-level connection object to a node's P2P interface.
This class is responsible for:
@@ -68,9 +66,7 @@ class NodeConn(asyncore.dispatcher):
- logging messages as they are sent and received
This class contains no logic for handing the P2P message payloads. It must be
- sub-classed and the on_message() callback overridden.
-
- TODO: rename this class P2PConnection."""
+ sub-classed and the on_message() callback overridden."""
def __init__(self):
super().__init__(map=mininode_socket_map)
@@ -244,7 +240,7 @@ class NodeConn(asyncore.dispatcher):
logger.debug(log_message)
-class NodeConnCB(NodeConn):
+class P2PInterface(P2PConnection):
"""A high-level P2P interface class for communicating with a Bitcoin node.
This class provides high-level callbacks for processing P2P message
@@ -252,9 +248,7 @@ class NodeConnCB(NodeConn):
node over P2P.
Individual testcases should subclass this and override the on_* methods
- if they want to alter message handling behaviour.
-
- TODO: rename this class P2PInterface"""
+ if they want to alter message handling behaviour."""
def __init__(self):
super().__init__()
@@ -399,10 +393,10 @@ mininode_socket_map = dict()
# One lock for synchronizing all data access between the networking thread (see
# NetworkThread below) and the thread running the test logic. For simplicity,
-# NodeConn acquires this lock whenever delivering a message to a NodeConnCB,
+# P2PConnection acquires this lock whenever delivering a message to a P2PInterface,
# and whenever adding anything to the send buffer (in send_message()). This
# lock should be acquired in the thread running the test logic to synchronize
-# access to any data shared with the NodeConnCB or NodeConn.
+# access to any data shared with the P2PInterface or P2PConnection.
mininode_lock = RLock()
class NetworkThread(Thread):