You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
316a0c5 rpc: addpeeraddress: throw on invalid IP (John Moffett)
Pull request description:
Right now we return an opaque `{"success" : false}` in `addpeeraddress` for an empty or invalid IP. This changes it to throw `RPC_CLIENT_INVALID_IP_OR_SUBNET` with the error message `Invalid IP address`. Tests updated to match.
ACKs for top commit:
sipa:
utACK 316a0c5
achow101:
ACK 316a0c5
vasild:
ACK 316a0c5
pablomartin4btc:
tACK 316a0c5
Tree-SHA512: 79a8ce127d0a24b2eb1f31bc3294b895d0c6424032a6b49168259e0e94aff69723d067adf1b4dc3c9b79e597531e5b65e4b8fc5a8e21fba0b81f99168de12b96
assert_raises_rpc_error(-30, "Invalid IP address", node.addpeeraddress, address="", port=8333)
350
350
assert_equal(node.getnodeaddresses(count=0), [])
351
351
352
+
self.log.debug("Test that adding a non-IP/hostname fails (no DNS lookup allowed)")
353
+
assert_raises_rpc_error(-30, "Invalid IP address", node.addpeeraddress, address="not_an_ip", port=8333)
354
+
352
355
self.log.debug("Test that non-bool tried fails")
353
356
assert_raises_rpc_error(-3, "JSON value of type string is not of expected type bool", self.nodes[0].addpeeraddress, address="1.2.3.4", tried="True", port=1234)
0 commit comments