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
This commit is contained in:
Odysseas Gabrielides 2023-02-22 19:10:28 +02:00 committed by pasta
parent 3a24170ac3
commit 01ebd60187
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -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<uint16_t>(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<uint16_t>(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]");
}