Use ParseFixedPoint instead of ParseDoubleV in "protx register" commands (#2458)
This commit is contained in:
parent
7cabbadefd
commit
2ba1ff5216
@ -327,11 +327,14 @@ UniValue protx_register(const JSONRPCRequest& request)
|
|||||||
keyIDVoting = ParsePubKeyIDFromAddress(request.params[paramIdx + 3].get_str(), "voting address");
|
keyIDVoting = ParsePubKeyIDFromAddress(request.params[paramIdx + 3].get_str(), "voting address");
|
||||||
}
|
}
|
||||||
|
|
||||||
double operatorReward = ParseDoubleV(request.params[paramIdx + 4], "operatorReward");
|
int64_t operatorReward;
|
||||||
if (operatorReward < 0 || operatorReward > 100) {
|
if (!ParseFixedPoint(request.params[paramIdx + 4].getValStr(), 2, &operatorReward)) {
|
||||||
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "operatorReward must be a number");
|
||||||
|
}
|
||||||
|
if (operatorReward < 0 || operatorReward > 10000) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "operatorReward must be between 0.00 and 100.00");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "operatorReward must be between 0.00 and 100.00");
|
||||||
}
|
}
|
||||||
ptx.nOperatorReward = (uint16_t)(operatorReward * 100);
|
ptx.nOperatorReward = operatorReward;
|
||||||
|
|
||||||
CBitcoinAddress payoutAddress(request.params[paramIdx + 5].get_str());
|
CBitcoinAddress payoutAddress(request.params[paramIdx + 5].get_str());
|
||||||
if (!payoutAddress.IsValid()) {
|
if (!payoutAddress.IsValid()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user