Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_net.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 RPC calls related to net. | """Test RPC calls related to net. | ||||
Tests correspond to code in rpc/net.cpp. | Tests correspond to code in rpc/net.cpp. | ||||
""" | """ | ||||
from decimal import Decimal | from decimal import Decimal | ||||
from itertools import product | from itertools import product | ||||
import time | import time | ||||
from test_framework.p2p import P2PInterface | |||||
import test_framework.messages | |||||
from test_framework.messages import ( | |||||
CAddress, | |||||
msg_addr, | |||||
NODE_NETWORK, | |||||
) | |||||
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_approx, | assert_approx, | ||||
assert_equal, | assert_equal, | ||||
assert_greater_than_or_equal, | assert_greater_than_or_equal, | ||||
assert_greater_than, | assert_greater_than, | ||||
assert_raises_rpc_error, | assert_raises_rpc_error, | ||||
connect_nodes, | connect_nodes, | ||||
p2p_port, | p2p_port, | ||||
wait_until, | wait_until, | ||||
) | ) | ||||
from test_framework.p2p import P2PInterface | |||||
import test_framework.messages | |||||
from test_framework.messages import ( | |||||
CAddress, | |||||
msg_addr, | |||||
NODE_NETWORK, | |||||
) | |||||
def assert_net_servicesnames(servicesflag, servicenames): | def assert_net_servicesnames(servicesflag, servicenames): | ||||
"""Utility that checks if all flags are correctly decoded in | """Utility that checks if all flags are correctly decoded in | ||||
`getpeerinfo` and `getnetworkinfo`. | `getpeerinfo` and `getnetworkinfo`. | ||||
:param servicesflag: The services as an integer. | :param servicesflag: The services as an integer. | ||||
:param servicenames: The list of decoded services names, as strings. | :param servicenames: The list of decoded services names, as strings. | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |