aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_net.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/rpc_net.py')
-rwxr-xr-xtest/functional/rpc_net.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 255f5108a2..4fbe22a846 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -66,6 +66,7 @@ class NetTest(BitcoinTestFramework):
self.test_getnodeaddresses()
self.test_addpeeraddress()
self.test_sendmsgtopeer()
+ self.test_getaddrmaninfo()
def test_connection_count(self):
self.log.info("Test getconnectioncount")
@@ -360,6 +361,28 @@ class NetTest(BitcoinTestFramework):
node.sendmsgtopeer(peer_id=0, msg_type="addr", msg=zero_byte_string.hex())
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 0, timeout=10)
+ def test_getaddrmaninfo(self):
+ self.log.info("Test getaddrmaninfo")
+ node = self.nodes[1]
+
+ self.log.debug("Test that getaddrmaninfo is a hidden RPC")
+ # It is hidden from general help, but its detailed help may be called directly.
+ assert "getaddrmaninfo" not in node.help()
+ assert "getaddrmaninfo" in node.help("getaddrmaninfo")
+
+ # current count of ipv4 addresses in addrman is {'new':1, 'tried':1}
+ self.log.info("Test that count of addresses in addrman match expected values")
+ res = node.getaddrmaninfo()
+ assert_equal(res["ipv4"]["new"], 1)
+ assert_equal(res["ipv4"]["tried"], 1)
+ assert_equal(res["ipv4"]["total"], 2)
+ assert_equal(res["all_networks"]["new"], 1)
+ assert_equal(res["all_networks"]["tried"], 1)
+ assert_equal(res["all_networks"]["total"], 2)
+ for net in ["ipv6", "onion", "i2p", "cjdns"]:
+ assert_equal(res[net]["new"], 0)
+ assert_equal(res[net]["tried"], 0)
+ assert_equal(res[net]["total"], 0)
if __name__ == '__main__':
NetTest().main()