Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_addr_relay.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 relay | Test addr relay | ||||
""" | """ | ||||
from test_framework.messages import ( | import time | ||||
CAddress, | |||||
NODE_NETWORK, | from test_framework.messages import NODE_NETWORK, CAddress, msg_addr | ||||
msg_addr, | |||||
) | |||||
from test_framework.p2p import P2PInterface | from test_framework.p2p import 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 assert_equal | ||||
assert_equal, | |||||
) | |||||
import time | |||||
ADDRS = [] | ADDRS = [] | ||||
for i in range(10): | for i in range(10): | ||||
addr = CAddress() | addr = CAddress() | ||||
addr.time = int(time.time()) + i | addr.time = int(time.time()) + i | ||||
addr.nServices = NODE_NETWORK | addr.nServices = NODE_NETWORK | ||||
addr.ip = "123.123.123.{}".format(i % 256) | addr.ip = "123.123.123.{}".format(i % 256) | ||||
addr.port = 8333 + i | addr.port = 8333 + i | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |