mirror of https://github.com/oxen-io/oxen-core.git
use new basis points function in rpc_command_executor
This commit is contained in:
parent
3662cb21fb
commit
872210608b
|
@ -256,7 +256,7 @@ std::optional<double> parse_fee_percent(std::string_view fee)
|
|||
return percent;
|
||||
}
|
||||
|
||||
uint64_t percent_to_basis_points(std::string percent_string) {
|
||||
uint16_t percent_to_basis_points(std::string percent_string) {
|
||||
const auto percent = parse_fee_percent(percent_string);
|
||||
if (!percent)
|
||||
throw invalid_registration{"could not parse fee percent"};
|
||||
|
|
|
@ -301,6 +301,6 @@ uint64_t get_portions_to_make_amount(uint64_t staking_requirement, uint64_t amou
|
|||
|
||||
std::optional<double> parse_fee_percent(std::string_view fee);
|
||||
|
||||
uint64_t percent_to_basis_points(std::string percent_string);
|
||||
uint16_t percent_to_basis_points(std::string percent_string);
|
||||
|
||||
}
|
||||
|
|
|
@ -2209,14 +2209,12 @@ Enter the operator fee as a percentage [0.00-100.00])");
|
|||
if (check_cancel_back(result))
|
||||
break;
|
||||
|
||||
auto pct = service_nodes::parse_fee_percent(operator_fee_str);
|
||||
if (pct)
|
||||
{
|
||||
state.operator_fee = static_cast<uint16_t>(std::lround(*pct / 100.0 * cryptonote::STAKING_FEE_BASIS));
|
||||
try {
|
||||
state.operator_fee = service_nodes::percent_to_basis_points(operator_fee_str);
|
||||
next_step(register_step::summary_info);
|
||||
}
|
||||
else
|
||||
} catch(const std::exception &e) {
|
||||
tools::fail_msg_writer() << "Invalid value: " << operator_fee_str << ". Fee must be between 0 and 100%" << std::endl;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue