Trivial: Protx operator reward clarification (#2407)

Add decimal places to clarify:
1. Non-integers are valid (e.g. 3.25)
2. Granularity - anything beyond x.xx is rounded (e.g. 3.259 -> 3.26)

This is due to DIP3 allowing values 0-10000 for operator reward (1/10000
= 0.01%)
This commit is contained in:
thephez 2018-11-01 17:58:36 -04:00 committed by UdjinM6
parent 7e8f07bb92
commit 1f56600c4b

View File

@ -203,7 +203,7 @@ void protx_register_fund_help()
" It has to match the private key which is later used when voting on proposals.\n" " It has to match the private key which is later used when voting on proposals.\n"
" If set to \"0\" or an empty string, ownerAddr will be used.\n" " If set to \"0\" or an empty string, ownerAddr will be used.\n"
"6. \"operatorReward\" (numeric, required) The fraction in % to share with the operator. If non-zero,\n" "6. \"operatorReward\" (numeric, required) The fraction in % to share with the operator. If non-zero,\n"
" \"ipAndPort\" must be zero as well. The value must be between 0 and 100.\n" " \"ipAndPort\" must be zero as well. The value must be between 0.00 and 100.00.\n"
"7. \"payoutAddress\" (string, required) The dash address to use for masternode reward payments\n" "7. \"payoutAddress\" (string, required) The dash address to use for masternode reward payments\n"
" Must match \"collateralAddress\"." " Must match \"collateralAddress\"."
"\nExamples:\n" "\nExamples:\n"
@ -329,7 +329,7 @@ UniValue protx_register(const JSONRPCRequest& request)
double operatorReward = ParseDoubleV(request.params[paramIdx + 4], "operatorReward"); double operatorReward = ParseDoubleV(request.params[paramIdx + 4], "operatorReward");
if (operatorReward < 0 || operatorReward > 100) { if (operatorReward < 0 || operatorReward > 100) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "operatorReward must be between 0 and 100"); throw JSONRPCError(RPC_INVALID_PARAMETER, "operatorReward must be between 0.00 and 100.00");
} }
ptx.nOperatorReward = (uint16_t)(operatorReward * 100); ptx.nOperatorReward = (uint16_t)(operatorReward * 100);