Skip to content

Commit 3457331

Browse files
committed
test: Add test for getpeerinfo bindaddr field
1 parent a7e3c28 commit 3457331

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/functional/net.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def run_test(self):
2929
self._test_getnettotals()
3030
self._test_getnetworkinginfo()
3131
self._test_getaddednodeinfo()
32+
self._test_getpeerinfo()
3233

3334
def _test_connection_count(self):
3435
# connect_nodes_bi connects each node to the other
@@ -88,6 +89,12 @@ def _test_getaddednodeinfo(self):
8889
assert_raises_jsonrpc(-24, "Node has not been added",
8990
self.nodes[0].getaddednodeinfo, '1.1.1.1')
9091

92+
def _test_getpeerinfo(self):
93+
peer_info = [x.getpeerinfo() for x in self.nodes]
94+
# check both sides of bidirectional connection between nodes
95+
# the address bound to on one side will be the source address for the other node
96+
assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr'])
97+
assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr'])
9198

9299
if __name__ == '__main__':
93100
NetTest().main()

0 commit comments

Comments
 (0)