Merge #15330: test: Fix race in p2p_invalid_messages
fac3a054cb
test: Fix race in p2p_invalid_messages (MarcoFalke)
Pull request description:
After we change our magic bytes, the node may or may not send us messages such as feefilter or sendheaders, which would be rejected by `_on_data`.
Solve that by replacing `_on_data` with a noop.
Tree-SHA512: bd25a81f0c6e31f09155e00abab8062777d827b9210d6a9b85ef35cfe5069338f100fecf058842f41a1f134fdb3cf7ac1fe80db493e4dab7988acdacb33149df
This commit is contained in:
commit
2fbf6a57d2
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2015-2018 The Bitcoin Core developers
|
||||
# Copyright (c) 2015-2019 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test node responses to invalid network messages."""
|
||||
|
@ -143,6 +143,7 @@ class InvalidMessagesTest(BitcoinTestFramework):
|
|||
|
||||
def test_magic_bytes(self):
|
||||
conn = self.nodes[0].add_p2p_connection(P2PDataStore())
|
||||
conn._on_data = lambda: None # Need to ignore all incoming messages from now, since they come with "invalid" magic bytes
|
||||
conn.magic_bytes = b'\x00\x11\x22\x32'
|
||||
with self.nodes[0].assert_debug_log(['PROCESSMESSAGE: INVALID MESSAGESTART ping']):
|
||||
conn.send_message(messages.msg_ping(nonce=0xff))
|
||||
|
@ -211,6 +212,5 @@ class InvalidMessagesTest(BitcoinTestFramework):
|
|||
return raw_msg_with_wrong_size
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
InvalidMessagesTest().main()
|
||||
|
|
Loading…
Reference in a new issue