diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-04-13 21:39:19 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-04-13 21:38:29 -0400 |
commit | fa4c29bc1d2425f861845bae4f3816d9817e622a (patch) | |
tree | f4ee69845cafc999f6a8ab5ab5d1c3c8007fe17d /test/functional/p2p_leak.py | |
parent | 6ef45bc9688412da9e13218e08f802125bf589c0 (diff) | |
download | bitcoin-fa4c29bc1d2425f861845bae4f3816d9817e622a.tar.xz |
test: Add various low-level p2p tests
Diffstat (limited to 'test/functional/p2p_leak.py')
-rwxr-xr-x | test/functional/p2p_leak.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/p2p_leak.py b/test/functional/p2p_leak.py index c574c1ab9f..76f33574a2 100755 --- a/test/functional/p2p_leak.py +++ b/test/functional/p2p_leak.py @@ -12,7 +12,12 @@ into sending us something it shouldn't.""" import time -from test_framework.messages import msg_getaddr, msg_ping, msg_verack +from test_framework.messages import ( + msg_getaddr, + msg_ping, + msg_verack, + msg_version, +) from test_framework.mininode import mininode_lock, P2PInterface from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( @@ -147,6 +152,15 @@ class P2PLeakTest(BitcoinTestFramework): assert_equal(ver.nStartingHeight, 201) assert_equal(ver.nRelay, 1) + self.log.info('Check that old nodes are disconnected') + p2p_old_node = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False) + old_version_msg = msg_version() + old_version_msg.nVersion = 31799 + wait_until(lambda: p2p_old_node.is_connected) + with self.nodes[0].assert_debug_log(['peer=4 using obsolete version 31799; disconnecting']): + p2p_old_node.send_message(old_version_msg) + p2p_old_node.wait_for_disconnect() + if __name__ == '__main__': P2PLeakTest().main() |