Skip to content

Commit d4a1da8

Browse files
committed
test: Make global TRANSPORT_VERSION variable an instance variable
Currently, transport version is a global variable declared as TRANSPORT_VERSION in v2_p2p.py. Making it an instance variable would help in sending non empty transport version packets for testing purposes. It might also help EncryptedP2PState be more extensible in far future protocol upgrades.
1 parent c642b08 commit d4a1da8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/test_framework/v2_p2p.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
IGNORE_BIT_POS = 7
2020
LENGTH_FIELD_LEN = 3
2121
MAX_GARBAGE_LEN = 4095
22-
TRANSPORT_VERSION = b''
2322

2423
SHORTID = {
2524
1: b"addr",
@@ -93,6 +92,7 @@ def __init__(self, *, initiating, net):
9392
# has been decrypted. set to -1 if decryption hasn't been done yet.
9493
self.contents_len = -1
9594
self.found_garbage_terminator = False
95+
self.transport_version = b''
9696

9797
@staticmethod
9898
def v2_ecdh(priv, ellswift_theirs, ellswift_ours, initiating):
@@ -169,7 +169,7 @@ def complete_handshake(self, response):
169169
msg_to_send += self.v2_enc_packet(decoy_content_len * b'\x00', aad=aad, ignore=True)
170170
aad = b''
171171
# Send version packet.
172-
msg_to_send += self.v2_enc_packet(TRANSPORT_VERSION, aad=aad)
172+
msg_to_send += self.v2_enc_packet(self.transport_version, aad=aad)
173173
return 64 - len(self.received_prefix), msg_to_send
174174

175175
def authenticate_handshake(self, response):

0 commit comments

Comments
 (0)