|
1 | 1 | #!/usr/bin/env python3
|
2 |
| -# Copyright (c) 2017-2022 The Bitcoin Core developers |
| 2 | +# Copyright (c) 2017-present The Bitcoin Core developers |
3 | 3 | # Distributed under the MIT software license, see the accompanying
|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 | """Test RPC calls related to net.
|
@@ -315,9 +315,11 @@ def test_addpeeraddress(self):
|
315 | 315 |
|
316 | 316 | self.log.debug("Test that adding an address with invalid port fails")
|
317 | 317 | assert_raises_rpc_error(-1, "JSON integer out of range", self.nodes[0].addpeeraddress, address="1.2.3.4", port=-1)
|
318 |
| - assert_raises_rpc_error(-1, "JSON integer out of range", self.nodes[0].addpeeraddress,address="1.2.3.4", port=65536) |
| 318 | + assert_raises_rpc_error(-1, "JSON integer out of range", self.nodes[0].addpeeraddress, address="1.2.3.4", port=65536) |
319 | 319 |
|
320 | 320 | self.log.debug("Test that adding a valid address to the tried table succeeds")
|
| 321 | + self.addr_time = int(time.time()) |
| 322 | + node.setmocktime(self.addr_time) |
321 | 323 | assert_equal(node.addpeeraddress(address="1.2.3.4", tried=True, port=8333), {"success": True})
|
322 | 324 | with node.assert_debug_log(expected_msgs=["CheckAddrman: new 0, tried 1, total 1 started"]):
|
323 | 325 | addrs = node.getnodeaddresses(count=0) # getnodeaddresses re-runs the addrman checks
|
@@ -402,8 +404,7 @@ def check_addr_information(result, expected):
|
402 | 404 | assert_equal(result["network"], expected["network"])
|
403 | 405 | assert_equal(result["source"], expected["source"])
|
404 | 406 | assert_equal(result["source_network"], expected["source_network"])
|
405 |
| - # To avoid failing on slow test runners, use a 10s vspan here. |
406 |
| - assert_approx(result["time"], time.time(), vspan=10) |
| 407 | + assert_equal(result["time"], self.addr_time) |
407 | 408 |
|
408 | 409 | def check_getrawaddrman_entries(expected):
|
409 | 410 | """Utility to compare a getrawaddrman result with expected addrman contents"""
|
|
0 commit comments