test: refactor: rename inbound to is_inbound

Makes it easier to recognize this variable represents a flag.
This commit is contained in:
stickies-v 2023-06-23 11:05:18 +01:00
parent afc0224cdb
commit ad90ba36bd
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757

View file

@ -121,11 +121,11 @@ class NetTracepointTest(BitcoinTestFramework):
checked_outbound_version_msg = 0
events = []
def check_p2p_message(event, inbound):
def check_p2p_message(event, is_inbound):
nonlocal checked_inbound_version_msg, checked_outbound_version_msg
if event.msg_type.decode("utf-8") == "version":
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]
msg = msg_version()
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["connection_type"],
event.peer_conn_type.decode("utf-8"))
if inbound:
if is_inbound:
checked_inbound_version_msg += 1
else:
checked_outbound_version_msg += 1
@ -157,8 +157,8 @@ class NetTracepointTest(BitcoinTestFramework):
self.log.info(
"check receipt and content of in- and outbound version messages")
for event, inbound in events:
check_p2p_message(event, inbound)
for event, is_inbound in events:
check_p2p_message(event, is_inbound)
assert_equal(EXPECTED_INOUTBOUND_VERSION_MSG,
checked_inbound_version_msg)
assert_equal(EXPECTED_INOUTBOUND_VERSION_MSG,