From 01ebd60187c2c6ee9ef40bbadd946f8005ea60de Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Wed, 22 Feb 2023 19:10:28 +0200 Subject: [PATCH] fix(rpc): don't parse platformHTTPPort platformP2PPort as strings (#5217) ## Issue being fixed or feature implemented In `protx register_hpmn`, `protx register_fund_hpmn`, `protx register_prepare_hpmn` and `protx update_service_hpmn` the fields `platformHTTPPort` and `platformP2PPort` were parsed as strings instead of integers. ## What was done? ## How Has This Been Tested? ## Breaking Changes ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation **For repository code-owners and collaborators only** - [x] I have assigned this pull request to a milestone --- src/rpc/evo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index b334be7f49..9735000787 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -665,13 +665,13 @@ static UniValue protx_register_common_wrapper(const JSONRPCRequest& request, } ptx.platformNodeID.SetHex(request.params[paramIdx + 6].get_str()); - int32_t requestedPlatformP2PPort = ParseInt32V(request.params[paramIdx + 7].get_str(), "platformP2PPort"); + int32_t requestedPlatformP2PPort = ParseInt32V(request.params[paramIdx + 7], "platformP2PPort"); if (!ValidatePlatformPort(requestedPlatformP2PPort)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "platformP2PPort must be a valid port [1-65535]"); } ptx.platformP2PPort = static_cast(requestedPlatformP2PPort); - int32_t requestedPlatformHTTPPort = ParseInt32V(request.params[paramIdx + 8].get_str(), "platformHTTPPort"); + int32_t requestedPlatformHTTPPort = ParseInt32V(request.params[paramIdx + 8], "platformHTTPPort"); if (!ValidatePlatformPort(requestedPlatformHTTPPort)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "platformHTTPPort must be a valid port [1-65535]"); } @@ -899,13 +899,13 @@ static UniValue protx_update_service_common_wrapper(const JSONRPCRequest& reques } ptx.platformNodeID.SetHex(request.params[paramIdx].get_str()); - int32_t requestedPlatformP2PPort = ParseInt32V(request.params[paramIdx + 1].get_str(), "platformP2PPort"); + int32_t requestedPlatformP2PPort = ParseInt32V(request.params[paramIdx + 1], "platformP2PPort"); if (!ValidatePlatformPort(requestedPlatformP2PPort)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "platformP2PPort must be a valid port [1-65535]"); } ptx.platformP2PPort = static_cast(requestedPlatformP2PPort); - int32_t requestedPlatformHTTPPort = ParseInt32V(request.params[paramIdx + 2].get_str(), "platformHTTPPort"); + int32_t requestedPlatformHTTPPort = ParseInt32V(request.params[paramIdx + 2], "platformHTTPPort"); if (!ValidatePlatformPort(requestedPlatformHTTPPort)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "platformHTTPPort must be a valid port [1-65535]"); }