aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/mininode.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-10-17 16:16:39 -0400
committerJohn Newbery <john@johnnewbery.com>2017-11-29 17:14:48 -0500
commit873beca6deda119077f53921f0d19c3ebfc7cc44 (patch)
tree426d8ecde39b8bf44612d5a9b4098d676a5c5917 /test/functional/test_framework/mininode.py
parent9f2c2dba21855b8cb9b193b1819be73fa4a23a99 (diff)
downloadbitcoin-873beca6deda119077f53921f0d19c3ebfc7cc44.tar.xz
[tests] Rename NodeConn and NodeConnCB
NodeConn -> P2PConnection NodeConnCB -> P2PInterface
Diffstat (limited to 'test/functional/test_framework/mininode.py')
-rwxr-xr-xtest/functional/test_framework/mininode.py22
1 files changed, 8 insertions, 14 deletions
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):