Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_getaddr_caching.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2020 The Bitcoin Core developers | # Copyright (c) 2020 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 addr response caching""" | """Test addr response caching""" | ||||
import time | import time | ||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
CAddress, | |||||
NODE_NETWORK, | NODE_NETWORK, | ||||
CAddress, | |||||
msg_addr, | msg_addr, | ||||
msg_getaddr, | msg_getaddr, | ||||
) | ) | ||||
from test_framework.p2p import ( | from test_framework.p2p import P2PInterface, p2p_lock | ||||
P2PInterface, | |||||
p2p_lock | |||||
) | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import assert_equal | ||||
assert_equal, | |||||
) | |||||
MAX_ADDR_TO_SEND = 1000 | MAX_ADDR_TO_SEND = 1000 | ||||
def gen_addrs(n): | def gen_addrs(n): | ||||
addrs = [] | addrs = [] | ||||
for i in range(n): | for i in range(n): | ||||
addr = CAddress() | addr = CAddress() | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |