diff options
author | amadeuszpawlik <apawlik@protonmail.com> | 2022-05-13 22:29:09 +0200 |
---|---|---|
committer | amadeuszpawlik <apawlik@protonmail.com> | 2022-05-14 10:22:16 +0200 |
commit | ada8358ef54aaa04c9182afe115d8046c801bdde (patch) | |
tree | 68022c45ccd0fc32fe9d5015bd15d959e7d1ad68 /test/functional | |
parent | 225e5b57b2ee2bc1acd7f09c89ccccc15ef8c85f (diff) |
Sanitize port in `addpeeraddress()`
- Ensures port sanitization in `addpeeraddress()`
- Adds test to check for invalid port values
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/rpc_net.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index 81a3cfee97..ad8ba06824 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -257,6 +257,10 @@ class NetTest(BitcoinTestFramework): assert_equal(node.addpeeraddress(address="", port=8333), {"success": False}) assert_equal(node.getnodeaddresses(count=0), []) + self.log.debug("Test that adding an address with invalid port fails") + assert_raises_rpc_error(-1, "JSON integer out of range", self.nodes[0].addpeeraddress, address="1.2.3.4", port=-1) + assert_raises_rpc_error(-1, "JSON integer out of range", self.nodes[0].addpeeraddress,address="1.2.3.4", port=65536) + self.log.debug("Test that adding a valid address to the tried table succeeds") assert_equal(node.addpeeraddress(address="1.2.3.4", tried=True, port=8333), {"success": True}) with node.assert_debug_log(expected_msgs=["CheckAddrman: new 0, tried 1, total 1 started"]): |