mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
test: refactor: rename inbound to is_inbound
Makes it easier to recognize this variable represents a flag.
This commit is contained in:
parent
afc0224cdb
commit
ad90ba36bd
1 changed files with 5 additions and 5 deletions
|
@ -121,11 +121,11 @@ class NetTracepointTest(BitcoinTestFramework):
|
||||||
checked_outbound_version_msg = 0
|
checked_outbound_version_msg = 0
|
||||||
events = []
|
events = []
|
||||||
|
|
||||||
def check_p2p_message(event, inbound):
|
def check_p2p_message(event, is_inbound):
|
||||||
nonlocal checked_inbound_version_msg, checked_outbound_version_msg
|
nonlocal checked_inbound_version_msg, checked_outbound_version_msg
|
||||||
if event.msg_type.decode("utf-8") == "version":
|
if event.msg_type.decode("utf-8") == "version":
|
||||||
self.log.info(
|
self.log.info(
|
||||||
f"check_p2p_message(): {'inbound' if inbound else 'outbound'} {event}")
|
f"check_p2p_message(): {'inbound' if is_inbound else 'outbound'} {event}")
|
||||||
peer = self.nodes[0].getpeerinfo()[0]
|
peer = self.nodes[0].getpeerinfo()[0]
|
||||||
msg = msg_version()
|
msg = msg_version()
|
||||||
msg.deserialize(BytesIO(bytes(event.msg[:event.msg_size])))
|
msg.deserialize(BytesIO(bytes(event.msg[:event.msg_size])))
|
||||||
|
@ -133,7 +133,7 @@ class NetTracepointTest(BitcoinTestFramework):
|
||||||
assert_equal(peer["addr"], event.peer_addr.decode("utf-8"))
|
assert_equal(peer["addr"], event.peer_addr.decode("utf-8"))
|
||||||
assert_equal(peer["connection_type"],
|
assert_equal(peer["connection_type"],
|
||||||
event.peer_conn_type.decode("utf-8"))
|
event.peer_conn_type.decode("utf-8"))
|
||||||
if inbound:
|
if is_inbound:
|
||||||
checked_inbound_version_msg += 1
|
checked_inbound_version_msg += 1
|
||||||
else:
|
else:
|
||||||
checked_outbound_version_msg += 1
|
checked_outbound_version_msg += 1
|
||||||
|
@ -157,8 +157,8 @@ class NetTracepointTest(BitcoinTestFramework):
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"check receipt and content of in- and outbound version messages")
|
"check receipt and content of in- and outbound version messages")
|
||||||
for event, inbound in events:
|
for event, is_inbound in events:
|
||||||
check_p2p_message(event, inbound)
|
check_p2p_message(event, is_inbound)
|
||||||
assert_equal(EXPECTED_INOUTBOUND_VERSION_MSG,
|
assert_equal(EXPECTED_INOUTBOUND_VERSION_MSG,
|
||||||
checked_inbound_version_msg)
|
checked_inbound_version_msg)
|
||||||
assert_equal(EXPECTED_INOUTBOUND_VERSION_MSG,
|
assert_equal(EXPECTED_INOUTBOUND_VERSION_MSG,
|
||||||
|
|
Loading…
Add table
Reference in a new issue