mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
test: Add test for getpeerinfo
bindaddr
field
This commit is contained in:
parent
a7e3c2814c
commit
3457331386
1 changed files with 7 additions and 0 deletions
|
@ -29,6 +29,7 @@ class NetTest(BitcoinTestFramework):
|
||||||
self._test_getnettotals()
|
self._test_getnettotals()
|
||||||
self._test_getnetworkinginfo()
|
self._test_getnetworkinginfo()
|
||||||
self._test_getaddednodeinfo()
|
self._test_getaddednodeinfo()
|
||||||
|
self._test_getpeerinfo()
|
||||||
|
|
||||||
def _test_connection_count(self):
|
def _test_connection_count(self):
|
||||||
# connect_nodes_bi connects each node to the other
|
# connect_nodes_bi connects each node to the other
|
||||||
|
@ -88,6 +89,12 @@ class NetTest(BitcoinTestFramework):
|
||||||
assert_raises_jsonrpc(-24, "Node has not been added",
|
assert_raises_jsonrpc(-24, "Node has not been added",
|
||||||
self.nodes[0].getaddednodeinfo, '1.1.1.1')
|
self.nodes[0].getaddednodeinfo, '1.1.1.1')
|
||||||
|
|
||||||
|
def _test_getpeerinfo(self):
|
||||||
|
peer_info = [x.getpeerinfo() for x in self.nodes]
|
||||||
|
# check both sides of bidirectional connection between nodes
|
||||||
|
# the address bound to on one side will be the source address for the other node
|
||||||
|
assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr'])
|
||||||
|
assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
NetTest().main()
|
NetTest().main()
|
||||||
|
|
Loading…
Reference in a new issue