Skip to content

Commit be979ad

Browse files
MarcoFalkefurszy
authored andcommitted
test: Fix race in p2p_invalid_messages
1 parent 6a72f0c commit be979ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/p2p_invalid_messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2015-2018 The Bitcoin Core developers
2+
# Copyright (c) 2015-2019 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test node responses to invalid network messages."""
@@ -139,6 +139,7 @@ def run_test(self):
139139

140140
def test_magic_bytes(self):
141141
conn = self.nodes[0].add_p2p_connection(P2PDataStore())
142+
conn._on_data = lambda: None # Need to ignore all incoming messages from now, since they come with "invalid" magic bytes
142143
conn.magic_bytes = b'\x00\x11\x22\x32'
143144
with self.nodes[0].assert_debug_log(['PROCESSMESSAGE: INVALID MESSAGESTART ping']):
144145
conn.send_message(messages.msg_ping(nonce=0xff))
@@ -207,6 +208,5 @@ def _tweak_msg_data_size(self, message, wrong_size):
207208
return raw_msg_with_wrong_size
208209

209210

210-
211211
if __name__ == '__main__':
212212
InvalidMessagesTest().main()

0 commit comments

Comments
 (0)