aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorstratospher <44024636+stratospher@users.noreply.github.com>2024-02-13 20:47:45 +0530
committerstratospher <44024636+stratospher@users.noreply.github.com>2024-06-21 19:37:13 +0530
commite351576862471fc77b1e798a16833439e23ff0b4 (patch)
treea3a90a38a6855692af66b72ba80512922a28510b /test/functional/test_framework
parente075fd131d668d9d1ba3c8566624481c4a57032d (diff)
test: Check that disconnection happens when >4095 garbage bytes is sent
This test type is represented using EXCESS_GARBAGE.
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/v2_p2p.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/functional/test_framework/v2_p2p.py b/test/functional/test_framework/v2_p2p.py
index 0d2f7f6ad2..87600c36de 100644
--- a/test/functional/test_framework/v2_p2p.py
+++ b/test/functional/test_framework/v2_p2p.py
@@ -109,10 +109,11 @@ class EncryptedP2PState:
# Responding, place their public key encoding first.
return TaggedHash("bip324_ellswift_xonly_ecdh", ellswift_theirs + ellswift_ours + ecdh_point_x32)
- def generate_keypair_and_garbage(self):
+ def generate_keypair_and_garbage(self, garbage_len=None):
"""Generates ellswift keypair and 4095 bytes garbage at max"""
self.privkey_ours, self.ellswift_ours = ellswift_create()
- garbage_len = random.randrange(MAX_GARBAGE_LEN + 1)
+ if garbage_len is None:
+ garbage_len = random.randrange(MAX_GARBAGE_LEN + 1)
self.sent_garbage = random.randbytes(garbage_len)
return self.ellswift_ours + self.sent_garbage