(self)
| 77 | assert_equal(self.nodes[0].getconnectioncount(), 2) |
| 78 | |
| 79 | def test_getpeerinfo(self): |
| 80 | self.log.info("Test getpeerinfo") |
| 81 | # Create a few getpeerinfo last_block/last_transaction values. |
| 82 | self.wallet.send_self_transfer(from_node=self.nodes[0]) # Make a transaction so we can see it in the getpeerinfo results |
| 83 | self.generate(self.nodes[1], 1) |
| 84 | time_now = int(time.time()) |
| 85 | peer_info = [x.getpeerinfo() for x in self.nodes] |
| 86 | # Verify last_block and last_transaction keys/values. |
| 87 | for node, peer, field in product(range(self.num_nodes), range(2), ['last_block', 'last_transaction']): |
| 88 | assert field in peer_info[node][peer].keys() |
| 89 | if peer_info[node][peer][field] != 0: |
| 90 | assert_approx(peer_info[node][peer][field], time_now, vspan=60) |
| 91 | # check both sides of bidirectional connection between nodes |
| 92 | # the address bound to on one side will be the source address for the other node |
| 93 | assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr']) |
| 94 | assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr']) |
| 95 | assert_equal(peer_info[0][0]['minfeefilter'], Decimal("0.00000500")) |
| 96 | assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000")) |
| 97 | # check the `servicesnames` field |
| 98 | for info in peer_info: |
| 99 | assert_net_servicesnames(int(info[0]["services"], 0x10), info[0]["servicesnames"]) |
| 100 | |
| 101 | assert_equal(peer_info[0][0]['connection_type'], 'inbound') |
| 102 | assert_equal(peer_info[0][1]['connection_type'], 'manual') |
| 103 | |
| 104 | assert_equal(peer_info[1][0]['connection_type'], 'manual') |
| 105 | assert_equal(peer_info[1][1]['connection_type'], 'inbound') |
| 106 | |
| 107 | # Check dynamically generated networks list in getpeerinfo help output. |
| 108 | assert "(ipv4, ipv6, onion, i2p, cjdns, not_publicly_routable)" in self.nodes[0].help("getpeerinfo") |
| 109 | |
| 110 | def test_getnettotals(self): |
| 111 | self.log.info("Test getnettotals") |
no test coverage detected