Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_net.py
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
connect_nodes(self.nodes[0], self.nodes[1]) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
connect_nodes(self.nodes[1], self.nodes[0]) | connect_nodes(self.nodes[1], self.nodes[0]) | ||||
self._test_connection_count() | self._test_connection_count() | ||||
self._test_getnettotals() | self._test_getnettotals() | ||||
self._test_getnetworkinfo() | self._test_getnetworkinfo() | ||||
self._test_getaddednodeinfo() | self._test_getaddednodeinfo() | ||||
self._test_getpeerinfo() | self._test_getpeerinfo() | ||||
self.test_service_flags() | |||||
self._test_getnodeaddresses() | self._test_getnodeaddresses() | ||||
def _test_connection_count(self): | def _test_connection_count(self): | ||||
# connect_nodes connects each node to the other | # connect_nodes connects each node to the other | ||||
assert_equal(self.nodes[0].getconnectioncount(), 2) | assert_equal(self.nodes[0].getconnectioncount(), 2) | ||||
def _test_getnettotals(self): | def _test_getnettotals(self): | ||||
# getnettotals totalbytesrecv and totalbytessent should be | # getnettotals totalbytesrecv and totalbytessent should be | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | def _test_getpeerinfo(self): | ||||
assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr']) | assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr']) | ||||
assert_equal(peer_info[0][0]['minfeefilter'], Decimal("0.00000500")) | assert_equal(peer_info[0][0]['minfeefilter'], Decimal("0.00000500")) | ||||
assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000")) | assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000")) | ||||
# check the `servicesnames` field | # check the `servicesnames` field | ||||
for info in peer_info: | for info in peer_info: | ||||
assert_net_servicesnames(int(info[0]["services"], 0x10), | assert_net_servicesnames(int(info[0]["services"], 0x10), | ||||
info[0]["servicesnames"]) | info[0]["servicesnames"]) | ||||
def test_service_flags(self): | |||||
self.nodes[0].add_p2p_connection( | |||||
P2PInterface(), services=( | |||||
1 << 5) | ( | |||||
1 << 63)) | |||||
assert_equal(['UNKNOWN[2^5]', 'UNKNOWN[2^63]'], | |||||
self.nodes[0].getpeerinfo()[-1]['servicesnames']) | |||||
self.nodes[0].disconnect_p2ps() | |||||
def _test_getnodeaddresses(self): | def _test_getnodeaddresses(self): | ||||
self.nodes[0].add_p2p_connection(P2PInterface()) | self.nodes[0].add_p2p_connection(P2PInterface()) | ||||
# send some addresses to the node via the p2p message addr | # send some addresses to the node via the p2p message addr | ||||
msg = msg_addr() | msg = msg_addr() | ||||
imported_addrs = [] | imported_addrs = [] | ||||
for i in range(256): | for i in range(256): | ||||
a = "123.123.123.{}".format(i) | a = "123.123.123.{}".format(i) | ||||
Show All 32 Lines |