Skip to content

Commit

Permalink
Use ParseFixedPoint instead of ParseDoubleV in "protx register" comma…
Browse files Browse the repository at this point in the history
…nds (#2458)
  • Loading branch information
codablock authored Nov 21, 2018
1 parent 7cabbad commit 2ba1ff5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/rpc/rpcevo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,14 @@ UniValue protx_register(const JSONRPCRequest& request)
keyIDVoting = ParsePubKeyIDFromAddress(request.params[paramIdx + 3].get_str(), "voting address");
}

double operatorReward = ParseDoubleV(request.params[paramIdx + 4], "operatorReward");
if (operatorReward < 0 || operatorReward > 100) {
int64_t operatorReward;
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");
}
ptx.nOperatorReward = (uint16_t)(operatorReward * 100);
ptx.nOperatorReward = operatorReward;

CBitcoinAddress payoutAddress(request.params[paramIdx + 5].get_str());
if (!payoutAddress.IsValid()) {
Expand Down

0 comments on commit 2ba1ff5

Please sign in to comment.