Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_fingerprint.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 various fingerprinting protections. | """Test various fingerprinting protections. | ||||
If an stale block more than a month old or its header are requested by a peer, | If an stale block more than a month old or its header are requested by a peer, | ||||
the node should pretend that it does not have it to avoid fingerprinting. | the node should pretend that it does not have it to avoid fingerprinting. | ||||
""" | """ | ||||
import time | import time | ||||
from test_framework.blocktools import (create_block, create_coinbase) | from test_framework.blocktools import (create_block, create_coinbase) | ||||
from test_framework.mininode import ( | from test_framework.messages import ( | ||||
CInv, | CInv, | ||||
P2PInterface, | |||||
msg_headers, | |||||
msg_block, | msg_block, | ||||
msg_getdata, | msg_getdata, | ||||
msg_getheaders, | msg_getheaders, | ||||
network_thread_start, | msg_headers, | ||||
wait_until, | |||||
) | ) | ||||
from test_framework.mininode import P2PInterface, network_thread_start | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal | from test_framework.util import assert_equal, wait_until | ||||
class P2PFingerprintTest(BitcoinTestFramework): | class P2PFingerprintTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
# Build a chain of blocks on top of given one | # Build a chain of blocks on top of given one | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |