diff options
author | Troy Giorshev <troygiorshev@gmail.com> | 2020-06-04 11:52:23 -0400 |
---|---|---|
committer | Troy Giorshev <troygiorshev@gmail.com> | 2020-06-08 00:54:52 -0400 |
commit | ff1e7b884447a5ba10553b2d964625f94e255bdc (patch) | |
tree | f6e671bcc8debe60221d7558ead5b9dd09822808 /test/functional/p2p_invalid_messages.py | |
parent | 57890abf2c7919eddfec36178b1136cd44ffe883 (diff) | |
download | bitcoin-ff1e7b884447a5ba10553b2d964625f94e255bdc.tar.xz |
Move size limits to module-global
As well, this renames those variables to match PEP8 and this clears up
the comment relating to VALID_DATA_LIMIT.
Admittedly, this commit is mainly to make the following ones cleaner.
Diffstat (limited to 'test/functional/p2p_invalid_messages.py')
-rwxr-xr-x | test/functional/p2p_invalid_messages.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/functional/p2p_invalid_messages.py b/test/functional/p2p_invalid_messages.py index 244a5a136d..38e823df47 100755 --- a/test/functional/p2p_invalid_messages.py +++ b/test/functional/p2p_invalid_messages.py @@ -23,6 +23,8 @@ from test_framework.mininode import ( ) from test_framework.test_framework import BitcoinTestFramework +MSG_LIMIT = 4 * 1000 * 1000 # 4MB, per MAX_PROTOCOL_MESSAGE_LENGTH +VALID_DATA_LIMIT = MSG_LIMIT - 5 # Account for the 5-byte length prefix class msg_unrecognized: """Nonsensical message. Modeled after similar types in test_framework.messages.""" @@ -61,8 +63,6 @@ class InvalidMessagesTest(BitcoinTestFramework): node.add_p2p_connection(P2PDataStore()) conn2 = node.add_p2p_connection(P2PDataStore()) - msg_limit = 4 * 1000 * 1000 # 4MB, per MAX_PROTOCOL_MESSAGE_LENGTH - valid_data_limit = msg_limit - 5 # Account for the 4-byte length prefix # # 0. @@ -70,8 +70,8 @@ class InvalidMessagesTest(BitcoinTestFramework): # Send as large a message as is valid, ensure we aren't disconnected but # also can't exhaust resources. # - msg_at_size = msg_unrecognized(str_data="b" * valid_data_limit) - assert len(msg_at_size.serialize()) == msg_limit + msg_at_size = msg_unrecognized(str_data="b" * VALID_DATA_LIMIT) + assert len(msg_at_size.serialize()) == MSG_LIMIT self.log.info("Sending a bunch of large, junk messages to test memory exhaustion. May take a bit...") |