Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_leak.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2017 The Bitcoin Core developers | # Copyright (c) 2017 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test message sending before handshake completion. | """Test message sending before handshake completion. | ||||
A node should never send anything other than VERSION/VERACK/REJECT until it's | A node should never send anything other than VERSION/VERACK/REJECT until it's | ||||
received a VERACK. | received a VERACK. | ||||
This test connects to a node and sends it a few messages, trying to intice it | This test connects to a node and sends it a few messages, trying to intice it | ||||
into sending us something it shouldn't.""" | into sending us something it shouldn't.""" | ||||
from test_framework.mininode import * | import time | ||||
from test_framework.mininode import ( | |||||
mininode_lock, | |||||
network_thread_join, | |||||
network_thread_start, | |||||
P2PInterface, | |||||
) | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import * | from test_framework.util import wait_until | ||||
banscore = 10 | banscore = 10 | ||||
class CLazyNode(P2PInterface): | class CLazyNode(P2PInterface): | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.unexpected_msg = False | self.unexpected_msg = False | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |