aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/test_framework/mininode.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-12-04 13:10:58 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-12-07 12:45:14 +0100
commitb2d7ada3727f026ccd83d3d64c75aab660d8053e (patch)
tree142613073843d1f0f9ba82a3a56a116734081513 /qa/rpc-tests/test_framework/mininode.py
parent82aff880d32f73bae28aa2cc071348ada603159b (diff)
downloadbitcoin-b2d7ada3727f026ccd83d3d64c75aab660d8053e.tar.xz
test: remove necessity to call create_callback_map
Remove necessity to call create_callback_map (as well as the function itself) from the Python P2P test framework. Invoke the appropriate methods directly. - Easy to forget to call it and wonder why it doesn't work - Simplifies the code - This makes it easier to handle new messages in subclasses Github-Pull: #7171 Rebased-From: 2f601d215da1683ae99ab9973219044c32fa2093
Diffstat (limited to 'qa/rpc-tests/test_framework/mininode.py')
-rwxr-xr-xqa/rpc-tests/test_framework/mininode.py24
1 files changed, 1 insertions, 23 deletions
diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py
index 64985d58e2..9d0fb713a1 100755
--- a/qa/rpc-tests/test_framework/mininode.py
+++ b/qa/rpc-tests/test_framework/mininode.py
@@ -1015,32 +1015,10 @@ class NodeConnCB(object):
return
time.sleep(0.05)
- # Derived classes should call this function once to set the message map
- # which associates the derived classes' functions to incoming messages
- def create_callback_map(self):
- self.cbmap = {
- "version": self.on_version,
- "verack": self.on_verack,
- "addr": self.on_addr,
- "alert": self.on_alert,
- "inv": self.on_inv,
- "getdata": self.on_getdata,
- "getblocks": self.on_getblocks,
- "tx": self.on_tx,
- "block": self.on_block,
- "getaddr": self.on_getaddr,
- "ping": self.on_ping,
- "pong": self.on_pong,
- "headers": self.on_headers,
- "getheaders": self.on_getheaders,
- "reject": self.on_reject,
- "mempool": self.on_mempool
- }
-
def deliver(self, conn, message):
with mininode_lock:
try:
- self.cbmap[message.command](conn, message)
+ getattr(self, 'on_' + message.command)(conn, message)
except:
print "ERROR delivering %s (%s)" % (repr(message),
sys.exc_info()[0])